Repository navigation
Record native histogram durations as milliseconds - #283
Merged
rluong003 merged 1 commit intoSep 22, 2026
Merged
Conversation
NativeDurationHistogram recorded seconds, chosen to match DurationBuckets.AsValues(). That alignment does not survive contact with how a native histogram is actually reported. Every other duration path in tally hands the reporter a time.Duration and lets it pick the unit: the statsd reporter emits milliseconds, the prometheus reporter seconds, the m3 reporter raw nanoseconds. A native histogram cannot work that way. record() feeds the value into the sketch on the way in, so the reporter receives an opaque pre-bucketed payload with no unit metadata and no opportunity to convert -- and 1000x is not a power-of-two shift, so a base-2 exponential histogram cannot be rescaled after the fact either. The unit therefore has to be fixed at the API rather than deferred, and milliseconds is the conventional choice for latency instrumentation. A backend deriving its own histograms from tally timers in milliseconds now agrees with these rather than sitting 1000x away from them, silently. The divergence from DurationBuckets is deliberate, documented on both the interface and the method, and pinned by a test so it cannot be quietly "corrected" back into alignment. No v7 tag has been published, so this changes no released behaviour.
rluong003
force-pushed
the
richard.luong/tally-native-histogram-milliseconds
branch
from
September 17, 2026 18:54
d0193de to
7b2fd43
Compare
rluong003
marked this pull request as ready for review
September 17, 2026 19:45
adamjeanlaurent
approved these changes
Sep 22, 2026
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.
NativeDurationHistogramrecorded seconds, matchingDurationBuckets.AsValues(). It should record milliseconds, so a native histogram lines up with the timer it replaces rather than sitting 1000x away from it.Verification
go build ./...,go test ./...,go vet .andgofmtall clean. Reverting the one line tovalue.Seconds()fails 12 assertions across 5 tests, so the unit is genuinely pinned.