chore: Record tracing durations via a canonical Duration attribute encoding - #2544
Open
sergerad wants to merge 2 commits into
Open
chore: Record tracing durations via a canonical Duration attribute encoding#2544sergerad wants to merge 2 commits into
sergerad wants to merge 2 commits into
Conversation
sergerad
force-pushed
the
sergerad-duration-record
branch
from
September 1, 2026 01:53
dae5861 to
8ecfcb4
Compare
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
Adds a canonical tracing encoding for
Durationvalues.The tracing field registry had no
RecordAttributeimplementation forDuration, so every call site that records a duration hand-converted it with.as_millis() as u64(or a saturatingtry_fromin one place) — eight sites across five crates, with inconsistent overflow behavior between them.This PR adds
impl RecordAttribute for Duration: durations are recorded as whole milliseconds in au64, saturating atu64::MAX. The allowed field names (retry.delay_ms,shutdown.grace_period_ms,snapshots.oldest_superseded_for_ms,timeout.ms) move fromNUMBER_FIELD_NAMESonto the impl, so each registry name has exactly one canonical type. All call sites now pass theDurationdirectly and the manual conversions are deleted.Note on
Option<Duration>: the write-worker site recordsoldest_superseded_for.unwrap_or_default()rather than theOptionitself, because the blanketOption<T>attribute encoding omits the field entirely onNone— the field must always be present on the span.Changelog