@@ -337,6 +337,31 @@ public void failHandlerErrorMetrics() {
337
337
});
338
338
}
339
339
340
+ @ Test
341
+ public void handlerErrorNonRetryableMetrics () {
342
+ TestWorkflow1 workflowStub =
343
+ testWorkflowRule .newWorkflowStubTimeoutOptions (TestWorkflow1 .class );
344
+ WorkflowFailedException workflowException =
345
+ Assert .assertThrows (
346
+ WorkflowFailedException .class , () -> workflowStub .execute ("handlererror-nonretryable" ));
347
+
348
+ Map <String , String > execFailedTags =
349
+ getOperationTags ()
350
+ .put (MetricsTag .TASK_FAILURE_TYPE , "handler_error_INTERNAL" )
351
+ .buildKeepingLast ();
352
+ Eventually .assertEventually (
353
+ Duration .ofSeconds (3 ),
354
+ () -> {
355
+ reporter .assertTimer (
356
+ MetricsType .NEXUS_SCHEDULE_TO_START_LATENCY , getBaseTags ().buildKeepingLast ());
357
+ reporter .assertTimer (
358
+ MetricsType .NEXUS_EXEC_LATENCY , getOperationTags ().buildKeepingLast ());
359
+ reporter .assertTimer (
360
+ MetricsType .NEXUS_TASK_E2E_LATENCY , getOperationTags ().buildKeepingLast ());
361
+ reporter .assertCounter (MetricsType .NEXUS_EXEC_FAILED_COUNTER , execFailedTags , 1 );
362
+ });
363
+ }
364
+
340
365
public static class TestNexus implements TestWorkflow1 {
341
366
@ Override
342
367
public String execute (String operation ) {
@@ -382,6 +407,11 @@ public OperationHandler<String, String> operation() {
382
407
throw new HandlerException (
383
408
HandlerException .ErrorType .BAD_REQUEST ,
384
409
ApplicationFailure .newFailure ("intentional failure" , "TestFailure" , "foo" ));
410
+ case "handlererror-nonretryable" :
411
+ throw new HandlerException (
412
+ HandlerException .ErrorType .INTERNAL ,
413
+ ApplicationFailure .newNonRetryableFailure ("intentional failure" , "TestFailure" ),
414
+ HandlerException .RetryBehavior .NON_RETRYABLE );
385
415
case "already-started" :
386
416
throw new WorkflowExecutionAlreadyStarted (
387
417
WorkflowExecution .getDefaultInstance (), "TestWorkflowType" , null );
0 commit comments