go-workflows
go-workflows copied to clipboard
Workflow task delay metrics doesn't account for timer events
For calculating how long a workflow task was in the queue, we use the timestamp of the first event in the task compared to the current time: https://github.com/cschleiden/go-workflows/blob/main/internal/worker/workflow.go#L128-L130
The issue is that future TimerFired
events get the timestamp at the time of creation as their timestamp:
https://github.com/cschleiden/go-workflows/blob/main/internal/command/schedule_timer.go#L48
So when they cause a workflow task to be scheduled, the time of when the event was scheduled is used which causes it to be recorded as a delay.