Skip to content

Fix activity_schedule_to_start_latency reporting activity_type unexpectedly - #2993

Open
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:fix/2733-activity-schedule-to-start-metric
Open

Fix activity_schedule_to_start_latency reporting activity_type unexpectedly#2993
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:fix/2733-activity-schedule-to-start-metric

Conversation

@sachinsharma3191

@sachinsharma3191 sachinsharma3191 commented Aug 10, 2026

Copy link
Copy Markdown

What was changed

Removed duplicate activity_schedule_to_start_latency recordings from ActivityPollTask and AsyncActivityPollTask.

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 in ActivityWorker.handleActivity with the correct activity_type tag. After this fix, the metric is emitted exactly once per activity task with the correct activity_type, consistent with how workflow_task_schedule_to_start_latency and nexus_schedule_to_start_latency are recorded.

The root cause was that ActivityPollTask.java and AsyncActivityPollTask.java used the poller-level metricsScope, which is tagged with activity_type="none" (from MetricsTag.defaultTags). ActivityWorker.handleActivity already creates a properly-tagged scope with the real activity type.

Checklist

  • Removed duplicate metric recording from ActivityPollTask.java (lines 123-127)
  • Removed duplicate metric recording from AsyncActivityPollTask.java (lines 124-128)
  • Verified ActivityWorker.handleActivity still records the metric with correct tags

Fixes #2733

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
@sachinsharma3191
sachinsharma3191 requested a review from a team as a code owner August 10, 2026 01:17
@dplyukhin

Copy link
Copy Markdown
Contributor

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.

@sachinsharma3191

Copy link
Copy Markdown
Author

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 activity_schedule_to_start_latency recordings from the poll tasks, keeping only the correctly-tagged emission in ActivityWorker.handleActivity. I've reviewed the change thoroughly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activity_schedule_to_start_latency reports activity_type unexpectedly

2 participants