Skip to content

Commit e3bd685

Browse files
committed
add event name to workflowtaskprocess as well
1 parent 0a53bac commit e3bd685

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

internal/metrickeys/metrickeys.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const (
77
WorkflowInstanceCreated = Prefix + "workflow.created"
88
WorkflowInstanceFinished = Prefix + "workflow.finished"
99

10-
WorkflowTaskScheduled = Prefix + "workflow.task.scheduled"
1110
WorkflowTaskProcessed = Prefix + "workflow.task.processed"
1211
WorkflowTaskDelay = Prefix + "workflow.task.time_in_queue"
1312

@@ -32,5 +31,5 @@ const (
3231
ContinuedAsNew = "continued_as_new"
3332

3433
ActivityName = "activity"
35-
EventName = "event"
34+
EventName = "event"
3635
)

internal/worker/workflow.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,16 @@ func (ww *WorkflowWorker) handle(ctx context.Context, t *task.Workflow) {
143143
scheduledAt = firstEvent.Timestamp // Use the timestamp of the first event as the schedule time
144144
}
145145

146+
eventName := fmt.Sprint(firstEvent.Type)
147+
146148
timeInQueue := time.Since(scheduledAt)
147149
ww.backend.Metrics().Distribution(metrickeys.WorkflowTaskDelay, metrics.Tags{
148-
metrickeys.EventName: fmt.Sprint(t.NewEvents[0].Type),
150+
metrickeys.EventName: eventName,
149151
}, float64(timeInQueue/time.Millisecond))
150152

151-
timer := metrics.Timer(ww.backend.Metrics(), metrickeys.WorkflowTaskProcessed, metrics.Tags{})
153+
timer := metrics.Timer(ww.backend.Metrics(), metrickeys.WorkflowTaskProcessed, metrics.Tags{
154+
metrickeys.EventName: eventName,
155+
})
152156

153157
result, err := ww.handleTask(ctx, t)
154158
if err != nil {

0 commit comments

Comments
 (0)