Add native histogram reporting to the reporter interfaces - #278
Merged
Merged
Conversation
Tally's timers and histograms are pre-bucketed, so percentiles cannot be
merged across sources. Native histograms derive their buckets from the
data and merge cleanly, but every value-carrying method in tally today is
a fixed-width number; a native histogram travels as a marshalled blob.
Nothing existing can carry one, so the reporter interfaces have to break.
This adds:
StatsReporter.ReportNativeHistogram(name, tags, payload, samples)
CachedStatsReporter.AllocateNativeHistogram(name, tags, maxBuckets)
CachedNativeHistogram.ReportNativeHistogram(payload, samples)
There is deliberately no per-bucket equivalent of CachedHistogramBucket.
A native histogram rescales its buckets as it observes values, so there
is no stable set of bounds to pre-allocate handles against; the whole
distribution is reported as one payload.
Every in-repo implementer is updated so the tree compiles. Most of them
are no-ops, because their wire formats cannot carry an opaque payload:
statsd carries scalar values only.
prometheus has native histograms of its own, but tally hands the
reporter an already-serialized payload in whatever encoding
the application chose, and a blob cannot become a
prometheus.Collector.
m3 speaks thrift over UDP with no payload field. This one is
not a plain no-op: it counts drops into
tally.internal.num-native-histograms-dropped, reported only
when non-zero so that fleets which never use native
histograms do not gain a permanently-zero series.
This commit lands before the NativeHistogram type it carries, so that the
type and the Scope surface can each be reviewed against an interface that
already exists.
|
|
This was referenced Sep 11, 2026
adamjeanlaurent
approved these changes
Sep 14, 2026
rluong003
marked this pull request as ready for review
September 14, 2026 21:37
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 PR sets up the reporter side of tally. In order to add native histogram support in tally we have two sides that we need to make changes to, the Scope which is the user face that application code records to, and then the reporter side that ships metrics out. This PR lets tally's reporter side accept the native histogram (but not ship yet).
Stack 1 of 4.
NativeHistogramtype — Add the native histogram metric types #279Scopesurface — Expose native histograms on Scope #280/v7— Rename the module to github.com/uber-go/tally/v7 #281