Skip to content

Commit 1ea51f7

Browse files
authored
[CDNC-3578] Worklfow start metric (cadence-workflow#5289)
* add workflow start metric * fix lint * remove logs and add workflow start scope * fix lint second attempt * emit metric in transferStandbyTaskExecutor
1 parent dc20ea8 commit 1ea51f7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

common/metrics/defs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,6 +2292,7 @@ const (
22922292
HistoryFailoverCallbackCount
22932293
WorkflowVersionCount
22942294
WorkflowTypeCount
2295+
WorkflowStartedCount
22952296
LargeHistoryBlobCount
22962297
LargeHistoryEventCount
22972298
LargeHistorySizeCount
@@ -2899,6 +2900,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
28992900
ReplicationTasksCount: {metricName: "replication_tasks_count", metricType: Timer},
29002901
WorkflowVersionCount: {metricName: "workflow_version_count", metricType: Gauge},
29012902
WorkflowTypeCount: {metricName: "workflow_type_count", metricType: Gauge},
2903+
WorkflowStartedCount: {metricName: "workflow_started_count", metricType: Counter},
29022904
LargeHistoryBlobCount: {metricName: "large_history_blob_count", metricType: Counter},
29032905
LargeHistoryEventCount: {metricName: "large_history_event_count", metricType: Counter},
29042906
LargeHistorySizeCount: {metricName: "large_history_size_count", metricType: Counter},

service/history/task/transfer_active_task_executor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,9 @@ func (t *transferActiveTaskExecutor) processRecordWorkflowStartedOrUpsertHelper(
952952
recordStart bool,
953953
) (retError error) {
954954

955+
workflowStartedScope := t.metricsClient.Scope(metrics.TransferActiveTaskRecordWorkflowStartedScope,
956+
metrics.DomainTag(task.DomainID))
957+
955958
wfContext, release, err := t.executionCache.GetOrCreateWorkflowExecutionWithTimeout(
956959
task.DomainID,
957960
getWorkflowExecution(task),
@@ -1011,6 +1014,7 @@ func (t *transferActiveTaskExecutor) processRecordWorkflowStartedOrUpsertHelper(
10111014
release(nil)
10121015

10131016
if recordStart {
1017+
workflowStartedScope.IncCounter(metrics.WorkflowStartedCount)
10141018
return t.recordWorkflowStarted(
10151019
ctx,
10161020
task.DomainID,

service/history/task/transfer_standby_task_executor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ func (t *transferStandbyTaskExecutor) processRecordWorkflowStartedOrUpsertHelper
455455
isRecordStart bool,
456456
) error {
457457

458+
workflowStartedScope := t.metricsClient.Scope(metrics.TransferStandbyTaskRecordWorkflowStartedScope,
459+
metrics.DomainTag(transferTask.DomainID))
460+
458461
// verify task version for RecordWorkflowStarted.
459462
// upsert doesn't require verifyTask, because it is just a sync of mutableState.
460463
if isRecordStart {
@@ -489,6 +492,7 @@ func (t *transferStandbyTaskExecutor) processRecordWorkflowStartedOrUpsertHelper
489492
numClusters := (int16)(len(domainEntry.GetReplicationConfig().Clusters))
490493

491494
if isRecordStart {
495+
workflowStartedScope.IncCounter(metrics.WorkflowStartedCount)
492496
return t.recordWorkflowStarted(
493497
ctx,
494498
transferTask.DomainID,

0 commit comments

Comments
 (0)