Skip to content

Commit ac92fcf

Browse files
vancexuyycptt
authored andcommitted
Fix metics of task ScheduledToStartLatency (#836)
1 parent 9f25f61 commit ac92fcf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/internal_task_pollers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) {
649649
wtp.metricsScope.Counter(metrics.DecisionPollSucceedCounter).Inc(1)
650650
wtp.metricsScope.Timer(metrics.DecisionPollLatency).Record(time.Now().Sub(startTime))
651651

652-
scheduledTime := time.Unix(0, response.GetScheduledTimestamp())
653-
wtp.metricsScope.Timer(metrics.DecisionScheduledToStartLatency).Record(time.Now().Sub(scheduledTime))
652+
scheduledToStartLatency := time.Duration(response.GetStartedTimestamp() - response.GetScheduledTimestamp())
653+
wtp.metricsScope.Timer(metrics.DecisionScheduledToStartLatency).Record(scheduledToStartLatency)
654654
return task, nil
655655
}
656656

@@ -793,8 +793,8 @@ func (atp *activityTaskPoller) poll(ctx context.Context) (interface{}, error) {
793793
atp.metricsScope.Counter(metrics.ActivityPollSucceedCounter).Inc(1)
794794
atp.metricsScope.Timer(metrics.ActivityPollLatency).Record(time.Now().Sub(startTime))
795795

796-
scheduledTime := time.Unix(0, response.GetScheduledTimestampOfThisAttempt())
797-
atp.metricsScope.Timer(metrics.ActivityScheduledToStartLatency).Record(time.Now().Sub(scheduledTime))
796+
scheduledToStartLatency := time.Duration(response.GetStartedTimestamp() - response.GetScheduledTimestampOfThisAttempt())
797+
atp.metricsScope.Timer(metrics.ActivityScheduledToStartLatency).Record(scheduledToStartLatency)
798798

799799
return &activityTask{task: response, pollStartTime: startTime}, nil
800800
}

0 commit comments

Comments
 (0)