Skip to content

Commit

Permalink
Add missing activity failure metric (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitarb committed Jun 24, 2021
1 parent e8455cb commit 754c666
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/internal_task_pollers.go
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,15 @@ func (atp *activityTaskPoller) ProcessTask(task interface{}) error {
executionStartTime := time.Now()
// Process the activity task.
request, err := atp.taskHandler.Execute(atp.taskQueueName, activityTask.task)
// err is returned in case of internal failure, such as unable to propagate context or context timeout.
if err != nil {
activityMetricsScope.Counter(metrics.ActivityExecutionFailedCounter).Inc(1)
return err
}
// in case if activity execution failed, request should be of type RespondActivityTaskFailedRequest
if _, ok := request.(*workflowservice.RespondActivityTaskFailedRequest); ok {
activityMetricsScope.Counter(metrics.ActivityExecutionFailedCounter).Inc(1)
}
activityMetricsScope.Timer(metrics.ActivityExecutionLatency).Record(time.Since(executionStartTime))

if request == ErrActivityResultPending {
Expand Down
1 change: 1 addition & 0 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func (ts *IntegrationTestSuite) TestActivityRetryOnError() {
ts.assertMetricsCounters(
"temporal_request", 7,
"temporal_request_attempt", 7,
"temporal_activity_execution_failed", 2,
"temporal_workflow_task_queue_poll_succeed", 1,
"temporal_long_request", 8,
"temporal_long_request_attempt", 8,
Expand Down

0 comments on commit 754c666

Please sign in to comment.