Skip to content

fix(sdk): prevent cumulative periodic metric reader drift - #5944

Open
shubhgupta2104 wants to merge 3 commits into
open-telemetry:mainfrom
shubhgupta2104:25366896+shubhgupta2104/fix-periodic-reader-drift
Open

shubhgupta2104 wants to merge 3 commits into
open-telemetry:mainfrom
shubhgupta2104:25366896+shubhgupta2104/fix-periodic-reader-drift

Conversation

@shubhgupta2104

@shubhgupta2104 shubhgupta2104 commented Nov 18, 2026 •

Copy link
Copy Markdown

Description

Use monotonic deadlines for PeriodicExportingMetricReader. Collection and export time no longer add to the configured interval on each cycle. Skip deadlines missed during a long collection instead of running catch-up exports.

Fixes #5943.

This change does not add wall-clock alignment.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Validation

  • tox -e py312-test-opentelemetry-sdk -- -q -o log_cli=false: 1,018 passed, 3 skipped.
  • The scheduling test has five deterministic scenarios: collection work, exact-deadline completion, overrun, timeout, and delayed wake-up.
  • The original ticker fails the scheduling regression test.
  • tox -e precommit: passed across the full repository.
  • tox -e lint-opentelemetry-sdk: passed.
  • tox -e typecheck: passed.

The SDK suite exited successfully but emitted 65 warnings and tracer-shutdown messages during process exit.

Checklist:

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting tox environments
  • This requires the following PR in contrib: none
  • Local code review completed

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-11-25 00:56 UTC

Merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with the author? Comment /dashboard route:author to route it back.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@shubhgupta2104
shubhgupta2104 marked this pull request as ready for review November 19, 2026 04:11
@shubhgupta2104
shubhgupta2104 requested a review from a team as a code owner November 19, 2026 04:11
Use monotonic deadlines and skip intervals missed during collection. Add
deterministic regression scenarios for work duration, exact-deadline completion,
overruns, timeouts, and delayed wake-ups.
@shubhgupta2104
shubhgupta2104 force-pushed the 25366896+shubhgupta2104/fix-periodic-reader-drift branch from 9ae5db3 to 9226666 Compare November 19, 2026 09:39
@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Nov 19, 2026

@Dotify71 Dotify71 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good fix for periodic metric drift and clean test coverage. LGTM, Thanks :))

@shubhgupta2104

Copy link
Copy Markdown
Author

Thanks @lzchen and @Dotify71 for your reviews.

@lzchen Can you authorise this pending CI run? Also, does any other designated reviewer needs to review before merging?

@lzchen

lzchen commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

We typically need 2 approvals from different companies for core repo  PRs

This branch has not been deployed

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

Labels

None yet

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

PeriodicExportingMetricReader adds collection and export time to each interval

3 participants