Fix activity_schedule_to_start_latency reporting activity_type unexpectedly - #2993
Conversation
The metric was recorded in three places: twice at poll time (sync and async pollers) with the default activity_type="none", and once in ActivityWorker.handleActivity with the correct activity_type tag. Remove the duplicate poll-time recordings so the metric is emitted exactly once per activity task with the proper activity_type. Fixes temporalio#2733
|
Thanks for the contrib. Is this PR still in progress? The checklist isn't checked off. If in progress, please convert to a draft PR. Please also update the PR description to use the template we provide. Does this address any outstanding issues? Please also take note of the contributing guidelines - particularly AI-generated PRs. Please make sure to review AI contributions thoroughly yourself before opening a PR. |
|
Thanks for the review! I've updated the PR description to use the repo's template format and checked off the checklist. This addresses issue #2733 — removes duplicate |
What was changed
Removed duplicate
activity_schedule_to_start_latencyrecordings fromActivityPollTaskandAsyncActivityPollTask.Why?
Issue #2733: the metric was being emitted three times per activity task — twice at poll time with
activity_type="none"(the default tag on poller-level scope), and once inActivityWorker.handleActivitywith the correctactivity_typetag. After this fix, the metric is emitted exactly once per activity task with the correctactivity_type, consistent with howworkflow_task_schedule_to_start_latencyandnexus_schedule_to_start_latencyare recorded.The root cause was that
ActivityPollTask.javaandAsyncActivityPollTask.javaused the poller-levelmetricsScope, which is tagged withactivity_type="none"(fromMetricsTag.defaultTags).ActivityWorker.handleActivityalready creates a properly-tagged scope with the real activity type.Checklist
ActivityPollTask.java(lines 123-127)AsyncActivityPollTask.java(lines 124-128)ActivityWorker.handleActivitystill records the metric with correct tagsFixes #2733