Repository navigation
fix(tracing): use monotonic export deadlines - #4063
Merged
seratch merged 1 commit intoJul 31, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request makes
BatchTraceProcessorscheduled exports use a monotonic clock consistently.The processor represents
schedule_delayas a relative deadline, but previously initialized, compared, and reset_next_export_timewithtime.time(). Wall time can move because of NTP corrections, host synchronization, timezone configuration, or manual changes:Scheduled-export initialization, comparison, and reset now use
time.monotonic(), matching the existing monotonic shutdown deadlines. Queue-size triggers, the worker polling cadence, force flush, shutdown draining, retries, trace timestamps, and exporter payloads are unchanged.No clock abstraction, public configuration, or alternate scheduling path is introduced.
Test plan
Replaced the previous scheduled-export test with a deterministic controlled-clock regression.
The previous test patched wall time and then called
shutdown()before counting exported items. Because shutdown always performs a final drain, it could pass even when the scheduled-export branch never executed.The replacement runs the worker decision loop without real sleeping, distinguishes no-argument scheduled exports from the final shutdown drain, and covers both directions:
Both cases fail against the original wall-clock implementation.
Validation completed successfully:
make formatmake lintmake typecheckmake testsCompatibility
This is an internal scheduling correction against the v0.19.1 behavior boundary. It changes no public signatures, configuration meaning, trace or span data, exporter payloads, persisted state, or backend protocol behavior.
Issue number
Closes #4057
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR