Skip to content

Commit

Permalink
Report correct workflow type name tag (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ardagan committed May 4, 2021
1 parent 9d610b4 commit 9dc9ac8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions service/history/historyEngine.go
Expand Up @@ -1409,12 +1409,13 @@ func (e *historyEngineImpl) RespondActivityTaskCompleted(

var activityStartedTime time.Time
var taskQueue string
var workflowTypeName string
err = e.updateWorkflowExecution(ctx, namespaceID, workflowExecution, true,
func(context workflowExecutionContext, mutableState mutableState) error {
workflowTypeName = mutableState.GetWorkflowType().GetName()
if !mutableState.IsWorkflowExecutionRunning() {
return ErrWorkflowCompleted
}

scheduleID := token.GetScheduleId()
if scheduleID == common.EmptyEventID { // client call CompleteActivityById, so get scheduleID by activityID
scheduleID, err0 = getScheduleID(token.GetActivityId(), mutableState)
Expand Down Expand Up @@ -1448,7 +1449,7 @@ func (e *historyEngineImpl) RespondActivityTaskCompleted(
scope := e.metricsClient.Scope(metrics.HistoryRespondActivityTaskCompletedScope).
Tagged(
metrics.NamespaceTag(namespace),
metrics.WorkflowTypeTag(token.WorkflowType),
metrics.WorkflowTypeTag(workflowTypeName),
metrics.ActivityTypeTag(token.ActivityType),
metrics.TaskQueueTag(taskQueue),
)
Expand Down Expand Up @@ -1483,8 +1484,10 @@ func (e *historyEngineImpl) RespondActivityTaskFailed(

var activityStartedTime time.Time
var taskQueue string
var workflowTypeName string
err = e.updateWorkflowExecutionWithAction(ctx, namespaceID, workflowExecution,
func(context workflowExecutionContext, mutableState mutableState) (*updateWorkflowAction, error) {
workflowTypeName = mutableState.GetWorkflowType().GetName()
if !mutableState.IsWorkflowExecutionRunning() {
return nil, ErrWorkflowCompleted
}
Expand Down Expand Up @@ -1533,7 +1536,7 @@ func (e *historyEngineImpl) RespondActivityTaskFailed(
scope := e.metricsClient.Scope(metrics.HistoryRespondActivityTaskFailedScope).
Tagged(
metrics.NamespaceTag(namespace),
metrics.WorkflowTypeTag(token.WorkflowType),
metrics.WorkflowTypeTag(workflowTypeName),
metrics.ActivityTypeTag(token.ActivityType),
metrics.TaskQueueTag(taskQueue),
)
Expand Down Expand Up @@ -1568,8 +1571,10 @@ func (e *historyEngineImpl) RespondActivityTaskCanceled(

var activityStartedTime time.Time
var taskQueue string
var workflowTypeName string
err = e.updateWorkflowExecution(ctx, namespaceID, workflowExecution, true,
func(context workflowExecutionContext, mutableState mutableState) error {
workflowTypeName = mutableState.GetWorkflowType().GetName()
if !mutableState.IsWorkflowExecutionRunning() {
return ErrWorkflowCompleted
}
Expand Down Expand Up @@ -1610,10 +1615,10 @@ func (e *historyEngineImpl) RespondActivityTaskCanceled(
return nil
})
if err == nil && !activityStartedTime.IsZero() {
scope := e.metricsClient.Scope(metrics.HistoryClientRespondActivityTaskCanceledScope).
scope := e.metricsClient.Scope(metrics.HistoryRespondActivityTaskCanceledScope).
Tagged(
metrics.NamespaceTag(namespace),
metrics.WorkflowTypeTag(token.WorkflowType),
metrics.WorkflowTypeTag(workflowTypeName),
metrics.ActivityTypeTag(token.ActivityType),
metrics.TaskQueueTag(taskQueue),
)
Expand Down

0 comments on commit 9dc9ac8

Please sign in to comment.