diff --git a/internal/activity.go b/internal/activity.go index 2711f67bc..232f3e1f1 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -356,6 +356,7 @@ func WithActivityTask( zapcore.Field{Key: tagWorkflowType, Type: zapcore.StringType, String: *task.WorkflowType.Name}, zapcore.Field{Key: tagWorkflowID, Type: zapcore.StringType, String: *task.WorkflowExecution.WorkflowId}, zapcore.Field{Key: tagRunID, Type: zapcore.StringType, String: *task.WorkflowExecution.RunId}, + zapcore.Field{Key: tagAttempt, Type: zapcore.Int64Type, Integer: int64(task.GetAttempt())}, ) return context.WithValue(ctx, activityEnvContextKey, &activityEnvironment{ diff --git a/internal/activity_task_handler_test.go b/internal/activity_task_handler_test.go index 3d424d5b4..14d0923f3 100644 --- a/internal/activity_task_handler_test.go +++ b/internal/activity_task_handler_test.go @@ -87,6 +87,7 @@ func TestActivityTaskHandler_Execute_deadline(t *testing.T) { ScheduleToCloseTimeoutSeconds: common.Int32Ptr(d.ScheduleDuration), StartedTimestamp: common.Int64Ptr(d.StartTS.UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(d.StartDuration), + Attempt: common.Int32Ptr(0), WorkflowType: &s.WorkflowType{ Name: common.StringPtr("wType"), }, @@ -139,6 +140,7 @@ func TestActivityTaskHandler_Execute_worker_stop(t *testing.T) { ScheduleToCloseTimeoutSeconds: common.Int32Ptr(1), StartedTimestamp: common.Int64Ptr(now.UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(1), + Attempt: common.Int32Ptr(0), WorkflowType: &s.WorkflowType{ Name: common.StringPtr("wType"), }, @@ -193,6 +195,7 @@ func TestActivityTaskHandler_Execute_with_propagators(t *testing.T) { ScheduleToCloseTimeoutSeconds: common.Int32Ptr(1), StartedTimestamp: common.Int64Ptr(now.UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(1), + Attempt: common.Int32Ptr(0), WorkflowType: &s.WorkflowType{ Name: common.StringPtr("wType"), }, @@ -245,6 +248,7 @@ func TestActivityTaskHandler_Execute_with_propagator_failure(t *testing.T) { ScheduleToCloseTimeoutSeconds: common.Int32Ptr(1), StartedTimestamp: common.Int64Ptr(now.UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(1), + Attempt: common.Int32Ptr(0), WorkflowType: &s.WorkflowType{ Name: common.StringPtr("wType"), }, @@ -301,6 +305,7 @@ func TestActivityTaskHandler_Execute_with_auto_heartbeat(t *testing.T) { StartedTimestamp: common.Int64Ptr(now.UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(1), HeartbeatTimeoutSeconds: common.Int32Ptr(1), + Attempt: common.Int32Ptr(0), WorkflowType: &s.WorkflowType{ Name: common.StringPtr("wType"), }, diff --git a/internal/internal_logging_tags.go b/internal/internal_logging_tags.go index 284792fce..f1b674af4 100644 --- a/internal/internal_logging_tags.go +++ b/internal/internal_logging_tags.go @@ -26,6 +26,7 @@ const ( tagDomain = "Domain" tagEventID = "EventID" tagEventType = "EventType" + tagAttempt = "Attempt" tagRunID = "RunID" tagTaskList = "TaskList" tagTimerID = "TimerID" diff --git a/internal/internal_task_pollers.go b/internal/internal_task_pollers.go index 74d385f6e..611394d5c 100644 --- a/internal/internal_task_pollers.go +++ b/internal/internal_task_pollers.go @@ -611,7 +611,9 @@ func (lath *localActivityTaskHandler) executeLocalActivityTask(task *localActivi zap.String(tagLocalActivityType, activityType), zap.String(tagWorkflowType, workflowType), zap.String(tagWorkflowID, task.params.WorkflowInfo.WorkflowExecution.ID), - zap.String(tagRunID, task.params.WorkflowInfo.WorkflowExecution.RunID)) + zap.String(tagRunID, task.params.WorkflowInfo.WorkflowExecution.RunID), + zap.Int64(tagAttempt, int64(task.attempt)), + ) metricsScope.Counter(metrics.LocalActivityTotalCounter).Inc(1) diff --git a/internal/internal_workers_test.go b/internal/internal_workers_test.go index 757d44c06..2557e3599 100644 --- a/internal/internal_workers_test.go +++ b/internal/internal_workers_test.go @@ -156,6 +156,7 @@ func (s *WorkersTestSuite) TestActivityWorkerStop() { ScheduleToCloseTimeoutSeconds: common.Int32Ptr(1), StartedTimestamp: common.Int64Ptr(time.Now().UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(1), + Attempt: common.Int32Ptr(0), WorkflowType: &m.WorkflowType{ Name: common.StringPtr("wType"), }, diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index 971299a19..997f440a4 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -1699,6 +1699,7 @@ func newTestActivityTask(workflowID, runID, activityID, workflowTypeName, domain StartedTimestamp: common.Int64Ptr(time.Now().UnixNano()), StartToCloseTimeoutSeconds: common.Int32Ptr(params.StartToCloseTimeoutSeconds), HeartbeatTimeoutSeconds: common.Int32Ptr(params.HeartbeatTimeoutSeconds), + Attempt: common.Int32Ptr(0), WorkflowType: &shared.WorkflowType{ Name: common.StringPtr(workflowTypeName), },