Skip to content

feat(metrics): report tally timers as histograms in seconds - #743

Open
Mohith26 wants to merge 3 commits into
uber:masterfrom
Mohith26:feat/prometheus-metrics-3-timers
Open

Mohith26 wants to merge 3 commits into
uber:masterfrom
Mohith26:feat/prometheus-metrics-3-timers

Conversation

@Mohith26

@Mohith26 Mohith26 commented Nov 7, 2026 •

Copy link
Copy Markdown

Depends on #742.

Adds histogram state to each series (non-cumulative bucket counts plus count and sum) and reports tally timers as histograms in seconds, using bucket upper bounds passed to the reporter. Bucket bounds are sorted, deduplicated, and infinite bounds are dropped since Prometheus always adds +Inf.

Testing: go test -race ./metrics/ (timer buckets/sum, bucket setup, timer vs counter type conflict), golangci-lint run ./metrics/... (0 issues), go build ./....

Stack (merge in order):

  1. feat(metrics): add Prometheus name sanitizing and series key helpers #735 Name sanitizing and series key helpers (61 lines)
  2. feat(metrics): add in-memory Prometheus reporter for counters and gauges #742 In-memory reporter for counters and gauges (118 lines)
  3. feat(metrics): report tally timers as histograms in seconds #743 Tally timers as histograms in seconds (83 lines) (this PR)
  4. feat(metrics): report tally histograms to the Prometheus reporter #744 Tally value/duration histograms (completes tally.StatsReporter) (87 lines)
  5. feat(metrics): expose the Prometheus reporter as a prometheus.Collector #745 prometheus.Collector with label padding, client_golang v1.20.5 bump (132 lines)
  6. feat(metrics): add Prometheus backend config #746 PrometheusConfig defaults and validation (85 lines)
  7. feat(metrics): add a Prometheus metrics backend #747 Register the prometheus backend (HTTP server, Close) and docs (113 lines)

Since these come from a fork, each PR is based on master and also contains the commits of the PRs before it, so the diff and the size check here include those until they merge. Only the last commit is new in this PR. I'll rebase each one as the earlier ones land. Line counts are additions in non-test files, which is what the size check counts.

First part of a Prometheus metrics backend. Adds helpers that turn tally
metric and tag names into valid Prometheus names and build a unique key
for a series from its name and labels.

Part of uber#161
Adds prometheusReporter, which keeps the latest state of every reported
series in memory: counters accumulate the deltas tally reports and gauges
keep the latest value. A name reported as two different metric types is
logged once and the later type is dropped.

Part of uber#161
Adds histogram state to prometheusReporter series and reports tally
timers as histograms in seconds, using a configurable set of bucket
upper bounds.

Part of uber#161

This branch has not been deployed

No deployments
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.

1 participant