Skip to content

Commit

Permalink
\adence-history does not emit continue-as-new metrics (cadence-workfl…
Browse files Browse the repository at this point in the history
…ow#4866)

* CDNC-1746: cadence-history does not emit continue-as-new metrics

- Emit metric when completing via ContinueAsNew
- Emit metric and logs when completing via unknown type, so that we'll
  know in the future if there are more types we should emit metrics for

* PR requests

* Revert "PR requests"

This reverts commit 832bcfe.

* PR requests try2
  • Loading branch information
ZackLK authored Jun 15, 2022
1 parent 9e6d122 commit 93bda8f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/log/tag/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ func WorkflowEventCount(eventCount int) Tag {
return newInt("wf-event-count", eventCount)
}

func WorkflowEventType(eventType string) Tag {
return newStringTag("wf-event-type", eventType)
}

/////////////////// System tags defined here: ///////////////////
// Tags with pre-define values

Expand Down
4 changes: 4 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,8 @@ const (
WorkflowFailedCount
WorkflowTimeoutCount
WorkflowTerminateCount
WorkflowContinuedAsNew
WorkflowCompletedUnknownType
ArchiverClientSendSignalCount
ArchiverClientSendSignalFailureCount
ArchiverClientHistoryRequestCount
Expand Down Expand Up @@ -2651,6 +2653,8 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
WorkflowFailedCount: {metricName: "workflow_failed", metricType: Counter},
WorkflowTimeoutCount: {metricName: "workflow_timeout", metricType: Counter},
WorkflowTerminateCount: {metricName: "workflow_terminate", metricType: Counter},
WorkflowContinuedAsNew: {metricName: "workflow_continued_as_new", metricType: Counter},
WorkflowCompletedUnknownType: {metricName: "workflow_completed_unknown_type", metricType: Counter},
ArchiverClientSendSignalCount: {metricName: "archiver_client_sent_signal", metricType: Counter},
ArchiverClientSendSignalFailureCount: {metricName: "archiver_client_send_signal_error", metricType: Counter},
ArchiverClientHistoryRequestCount: {metricName: "archiver_client_history_request", metricType: Counter},
Expand Down
10 changes: 10 additions & 0 deletions service/history/execution/context_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,15 @@ func emitWorkflowCompletionStats(
tag.WorkflowRunID(runID),
tag.WorkflowDomainName(domainName),
)
case types.EventTypeWorkflowExecutionContinuedAsNew:
scope.IncCounter(metrics.WorkflowContinuedAsNew)
default:
scope.IncCounter(metrics.WorkflowCompletedUnknownType)
logger.Warn("Workflow completed with an unknown event type",
tag.WorkflowEventType(event.EventType.String()),
tag.WorkflowID(workflowID),
tag.WorkflowRunID(runID),
tag.WorkflowDomainName(domainName),
)
}
}

0 comments on commit 93bda8f

Please sign in to comment.