Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static io.temporal.serviceclient.MetricsTag.METRICS_TAGS_CALL_OPTIONS_KEY;

import com.google.protobuf.DoubleValue;
import com.google.protobuf.Timestamp;
import com.uber.m3.tally.Scope;
import io.grpc.Context;
import io.temporal.api.common.v1.WorkerVersionCapabilities;
Expand Down Expand Up @@ -113,10 +112,11 @@ public CompletableFuture<ActivityTask> poll(SlotPermit permit) {
metricsScope.counter(MetricsType.ACTIVITY_POLL_NO_TASK_COUNTER).inc(1);
return null;
}
Timestamp startedTime = ProtobufTimeUtils.getCurrentProtoTime();
metricsScope
.timer(MetricsType.ACTIVITY_SCHEDULE_TO_START_LATENCY)
.record(ProtobufTimeUtils.toM3Duration(startedTime, r.getScheduledTime()));
.record(
ProtobufTimeUtils.toM3Duration(
r.getStartedTime(), r.getCurrentAttemptScheduledTime()));
return new ActivityTask(
r,
permit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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

import com.google.protobuf.Timestamp;
import com.uber.m3.tally.Scope;
import com.uber.m3.util.ImmutableMap;
import io.grpc.Context;
Expand Down Expand Up @@ -154,10 +153,9 @@ public CompletableFuture<WorkflowTask> poll(SlotPermit permit)
pollerMetricScope
.counter(MetricsType.WORKFLOW_TASK_QUEUE_POLL_SUCCEED_COUNTER)
.inc(1);
Timestamp startedTime = ProtobufTimeUtils.getCurrentProtoTime();
pollerMetricScope
.timer(MetricsType.WORKFLOW_TASK_SCHEDULE_TO_START_LATENCY)
.record(ProtobufTimeUtils.toM3Duration(startedTime, r.getScheduledTime()));
.record(ProtobufTimeUtils.toM3Duration(r.getStartedTime(), r.getScheduledTime()));
Comment on lines -160 to +158
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea of what the practical time difference could be for users that may be monitoring this metric? I guess we can just call it out in release notes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clock skew between the Server and Worker, maybe some unaccounted for network time. The main issue is the async poller was measuring it differently then everywhere else which is a bug.

Comment on lines -160 to +158
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this same logic for activity, do we want to update that one to use the activity poll response start time too? I also saw this logic with Nexus, but no start time on its response (I also confirmed the activity and workflow started time fields on the response go as far back as Temporal, so we're safe for old server versions)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good catch, fixed

return new WorkflowTask(r, (reason) -> slotSupplier.releaseSlot(reason, permit));
})
.whenComplete(
Expand Down
Loading