Skip to content

Add native histogram reporting to the reporter interfaces - #278

Merged
rluong003 merged 1 commit into
masterfrom
richard.luong/tally-native-histogram-reporters
Sep 14, 2026
Merged

rluong003 merged 1 commit into
masterfrom
richard.luong/tally-native-histogram-reporters

Conversation

@rluong003

@rluong003 rluong003 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

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.

  1. Reporter interfacesAdd native histogram reporting to the reporter interfaces #278
  2. The NativeHistogram type — Add the native histogram metric types #279
  3. The Scope surface — Expose native histograms on Scope #280
  4. Module rename to /v7Rename the module to github.com/uber-go/tally/v7 #281

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.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rluong003
rluong003 marked this pull request as ready for review September 14, 2026 21:37
@rluong003
rluong003 merged commit 3babbc2 into master Sep 14, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants