Skip to content

Commit 850515b

Browse files
Align workflow_task_schedule_to_start_latency (#2669)
Align workflow_task_schedule_to_start_latency
1 parent 9cd7ca8 commit 850515b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

temporal-sdk/src/main/java/io/temporal/internal/worker/AsyncActivityPollTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static io.temporal.serviceclient.MetricsTag.METRICS_TAGS_CALL_OPTIONS_KEY;
44

55
import com.google.protobuf.DoubleValue;
6-
import com.google.protobuf.Timestamp;
76
import com.uber.m3.tally.Scope;
87
import io.grpc.Context;
98
import io.temporal.api.common.v1.WorkerVersionCapabilities;
@@ -113,10 +112,11 @@ public CompletableFuture<ActivityTask> poll(SlotPermit permit) {
113112
metricsScope.counter(MetricsType.ACTIVITY_POLL_NO_TASK_COUNTER).inc(1);
114113
return null;
115114
}
116-
Timestamp startedTime = ProtobufTimeUtils.getCurrentProtoTime();
117115
metricsScope
118116
.timer(MetricsType.ACTIVITY_SCHEDULE_TO_START_LATENCY)
119-
.record(ProtobufTimeUtils.toM3Duration(startedTime, r.getScheduledTime()));
117+
.record(
118+
ProtobufTimeUtils.toM3Duration(
119+
r.getStartedTime(), r.getCurrentAttemptScheduledTime()));
120120
return new ActivityTask(
121121
r,
122122
permit,

temporal-sdk/src/main/java/io/temporal/internal/worker/AsyncWorkflowPollTask.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static io.temporal.serviceclient.MetricsTag.METRICS_TAGS_CALL_OPTIONS_KEY;
44

5-
import com.google.protobuf.Timestamp;
65
import com.uber.m3.tally.Scope;
76
import com.uber.m3.util.ImmutableMap;
87
import io.grpc.Context;
@@ -154,10 +153,9 @@ public CompletableFuture<WorkflowTask> poll(SlotPermit permit)
154153
pollerMetricScope
155154
.counter(MetricsType.WORKFLOW_TASK_QUEUE_POLL_SUCCEED_COUNTER)
156155
.inc(1);
157-
Timestamp startedTime = ProtobufTimeUtils.getCurrentProtoTime();
158156
pollerMetricScope
159157
.timer(MetricsType.WORKFLOW_TASK_SCHEDULE_TO_START_LATENCY)
160-
.record(ProtobufTimeUtils.toM3Duration(startedTime, r.getScheduledTime()));
158+
.record(ProtobufTimeUtils.toM3Duration(r.getStartedTime(), r.getScheduledTime()));
161159
return new WorkflowTask(r, (reason) -> slotSupplier.releaseSlot(reason, permit));
162160
})
163161
.whenComplete(

0 commit comments

Comments
 (0)