diff --git a/service/history/execution/context.go b/service/history/execution/context.go index 2d3ef69724e..c26954894e3 100644 --- a/service/history/execution/context.go +++ b/service/history/execution/context.go @@ -526,7 +526,9 @@ func (c *contextImpl) ConflictResolveWorkflowExecution( if event, err := resetMutableState.GetCompletionEvent(ctx); err == nil { workflowType := resetWorkflow.ExecutionInfo.WorkflowTypeName taskList := resetWorkflow.ExecutionInfo.TaskList - emitWorkflowCompletionStats(c.metricsClient, domainName, workflowType, taskList, event) + emitWorkflowCompletionStats(c.metricsClient, c.logger, + domainName, workflowType, c.workflowExecution.GetWorkflowID(), c.workflowExecution.GetRunID(), + taskList, event) } } @@ -754,7 +756,9 @@ func (c *contextImpl) UpdateWorkflowExecutionWithNew( if event, err := c.mutableState.GetCompletionEvent(ctx); err == nil { workflowType := currentWorkflow.ExecutionInfo.WorkflowTypeName taskList := currentWorkflow.ExecutionInfo.TaskList - emitWorkflowCompletionStats(c.metricsClient, domainName, workflowType, taskList, event) + emitWorkflowCompletionStats(c.metricsClient, c.logger, + domainName, workflowType, c.workflowExecution.GetWorkflowID(), c.workflowExecution.GetRunID(), + taskList, event) } } diff --git a/service/history/execution/context_util.go b/service/history/execution/context_util.go index 02109fd92fa..3bc061138f5 100644 --- a/service/history/execution/context_util.go +++ b/service/history/execution/context_util.go @@ -23,6 +23,9 @@ package execution import ( "time" + "github.com/uber/cadence/common/log" + "github.com/uber/cadence/common/log/tag" + "github.com/uber/cadence/common/metrics" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/types" @@ -112,8 +115,11 @@ func emitSessionUpdateStats( func emitWorkflowCompletionStats( metricsClient metrics.Client, + logger log.Logger, domainName string, workflowType string, + workflowID string, + runID string, taskList string, event *types.HistoryEvent, ) { @@ -138,7 +144,17 @@ func emitWorkflowCompletionStats( scope.IncCounter(metrics.WorkflowFailedCount) case types.EventTypeWorkflowExecutionTimedOut: scope.IncCounter(metrics.WorkflowTimeoutCount) + logger.Info("workflow execution timed out", + tag.WorkflowID(workflowID), + tag.WorkflowRunID(runID), + tag.WorkflowDomainName(domainName), + ) case types.EventTypeWorkflowExecutionTerminated: scope.IncCounter(metrics.WorkflowTerminateCount) + logger.Info("workflow terminated", + tag.WorkflowID(workflowID), + tag.WorkflowRunID(runID), + tag.WorkflowDomainName(domainName), + ) } }