Repository navigation
Conversation
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
This was referenced Nov 7, 2026
This branch has not been deployed
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.
Depends on #735.
Adds
prometheusReporter, which keeps the latest state of each reported series in memory. Counters accumulate the deltas tally reports and gauges keep the latest value. Empty tag values are dropped so they map to the same series as a missing tag (Prometheus treats them the same). If a name is reported as two different metric types, the later type is dropped and a warning is logged once, instead of breaking the scrape later.Testing:
go test -race ./metrics/(counter/gauge state, empty tag values, type conflicts, name sanitizing),golangci-lint run ./metrics/...(0 issues),go build ./....Stack (merge in order):
prometheusbackend (HTTP server, Close) and docs (113 lines)Since these come from a fork, each PR is based on
masterand 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.