Skip to content

Commit 7d57a66

Browse files
authoredOct 4, 2024··
ensure WorkflowTaskExecutionFailureCounter is called with a tag (#1658)
1 parent d7a2128 commit 7d57a66

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
 

‎internal/internal_event_handlers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent(
11701170
}
11711171
defer func() {
11721172
if p := recover(); p != nil {
1173-
weh.metricsHandler.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1)
1173+
incrementWorkflowTaskFailureCounter(weh.metricsHandler, "NonDeterminismError")
11741174
topLine := fmt.Sprintf("process event for %s [panic]:", weh.workflowInfo.TaskQueueName)
11751175
st := getStackTraceRaw(topLine, 7, 0)
11761176
weh.Complete(nil, newWorkflowPanicError(p, st))
@@ -1373,7 +1373,7 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessMessage(
13731373
) error {
13741374
defer func() {
13751375
if p := recover(); p != nil {
1376-
weh.metricsHandler.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1)
1376+
incrementWorkflowTaskFailureCounter(weh.metricsHandler, "NonDeterminismError")
13771377
topLine := fmt.Sprintf("process message for %s [panic]:", weh.workflowInfo.TaskQueueName)
13781378
st := getStackTraceRaw(topLine, 7, 0)
13791379
weh.Complete(nil, newWorkflowPanicError(p, st))

‎internal/internal_task_pollers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ func (wtp *workflowTaskPoller) RespondTaskCompletedWithMetrics(
471471
if failWorkflowTask.Cause == enumspb.WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR {
472472
failureReason = "NonDeterminismError"
473473
}
474-
metricsHandler.WithTags(metrics.WorkflowTaskFailedTags(failureReason)).Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1)
474+
incrementWorkflowTaskFailureCounter(metricsHandler, failureReason)
475475
completedRequest = failWorkflowTask
476476
}
477477

‎internal/internal_workflow.go

+4
Original file line numberDiff line numberDiff line change
@@ -1960,3 +1960,7 @@ func (s *semaphoreImpl) Release(n int64) {
19601960
panic("Semaphore.Release() released more than held")
19611961
}
19621962
}
1963+
1964+
func incrementWorkflowTaskFailureCounter(metricsHandler metrics.Handler, failureReason string) {
1965+
metricsHandler.WithTags(metrics.WorkflowTaskFailedTags(failureReason)).Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1)
1966+
}

0 commit comments

Comments
 (0)
Please sign in to comment.