diff --git a/service/history/task/timer_active_task_executor.go b/service/history/task/timer_active_task_executor.go index 6f39fdfe559..2352b9d5ad7 100644 --- a/service/history/task/timer_active_task_executor.go +++ b/service/history/task/timer_active_task_executor.go @@ -273,6 +273,11 @@ func (t *timerActiveTaskExecutor) executeActivityTimeoutTask( } defer func() { release(retError) }() + domainName, err := t.shard.GetDomainCache().GetDomainName(task.DomainID) + if err != nil { + return fmt.Errorf("unable to find domainID: %v, err: %v", task.DomainID, err) + } + mutableState, err := loadMutableStateForTimerTask(ctx, wfContext, task, t.metricsClient, t.logger) if err != nil { return err @@ -281,6 +286,11 @@ func (t *timerActiveTaskExecutor) executeActivityTimeoutTask( return nil } + wfType := mutableState.GetWorkflowType() + if wfType == nil { + return fmt.Errorf("unable to find workflow type, task %s", task) + } + timerSequence := execution.NewTimerSequence(mutableState) referenceTime := t.shard.GetTimeSource().Now() resurrectionCheckMinDelay := t.config.ResurrectionCheckMinDelay(mutableState.GetDomainEntry().GetInfo().Name) @@ -398,7 +408,18 @@ Loop: mutableState.GetExecutionInfo().DomainID, metrics.TimerActiveTaskActivityTimeoutScope, timerSequenceID.TimerType, + metrics.WorkflowTypeTag(wfType.GetName()), + ) + + t.logger.Info("Activity timed out", + tag.WorkflowDomainName(domainName), + tag.WorkflowDomainID(task.GetDomainID()), + tag.WorkflowID(task.GetWorkflowID()), + tag.WorkflowRunID(task.GetRunID()), + tag.ScheduleAttempt(task.ScheduleAttempt), + tag.FailoverVersion(task.GetVersion()), ) + if _, err := mutableState.AddActivityTaskTimedOutEvent( activityInfo.ScheduleID, activityInfo.StartedID, @@ -435,6 +456,11 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask( } defer func() { release(retError) }() + domainName, err := t.shard.GetDomainCache().GetDomainName(task.DomainID) + if err != nil { + return fmt.Errorf("unable to find domainID: %v, err: %v", task.DomainID, err) + } + mutableState, err := loadMutableStateForTimerTask(ctx, wfContext, task, t.metricsClient, t.logger) if err != nil { return err @@ -443,6 +469,11 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask( return nil } + wfType := mutableState.GetWorkflowType() + if wfType == nil { + return fmt.Errorf("unable to find workflow type, task %s", task) + } + scheduleID := task.EventID decision, ok := mutableState.GetDecisionInfo(scheduleID) if !ok { @@ -464,13 +495,14 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask( if isStickyDecision { decisionTypeTag = stickyDecisionTypeTag } + tags := []metrics.Tag{metrics.WorkflowTypeTag(wfType.GetName()), decisionTypeTag} switch execution.TimerTypeFromInternal(types.TimeoutType(task.TimeoutType)) { case execution.TimerTypeStartToClose: t.emitTimeoutMetricScopeWithDomainTag( mutableState.GetExecutionInfo().DomainID, metrics.TimerActiveTaskDecisionTimeoutScope, execution.TimerTypeStartToClose, - decisionTypeTag, + tags..., ) if _, err := mutableState.AddDecisionTaskTimedOutEvent( decision.ScheduleID, @@ -488,6 +520,7 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask( if !isStickyDecision { t.logger.Warn("Potential lost normal decision task", + tag.WorkflowDomainName(domainName), tag.WorkflowDomainID(task.GetDomainID()), tag.WorkflowID(task.GetWorkflowID()), tag.WorkflowRunID(task.GetRunID()), @@ -501,7 +534,7 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask( mutableState.GetExecutionInfo().DomainID, metrics.TimerActiveTaskDecisionTimeoutScope, execution.TimerTypeScheduleToStart, - decisionTypeTag, + tags..., ) _, err := mutableState.AddDecisionTaskScheduleToStartTimeoutEvent(scheduleID) if err != nil {