Repository navigation
feat: preserve metric suffixes in OpenMetrics 2.0 - #2529
Merged
zeitlinger merged 5 commits intoOct 15, 2026
Merged
Conversation
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
arnabnandy7
requested review from
dhoard,
fstab,
jaydeluca and
zeitlinger
as code owners
October 7, 2026 09:48
Member
|
Let's discuss the feature in #2518 first. |
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Contributor
|
Contributor
Author
@zeitlinger sure thanks, I'll post in issue for further discussion. |
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger
force-pushed
the
feature/openMetricsSuffixes
branch
from
October 13, 2026 16:20
4c98ad5 to
608b1f4
Compare
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger
approved these changes
Oct 15, 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.
Summary
Add an opt-in OpenMetrics 2.0 compatibility setting for applications migrating from the existing client_java naming behavior.
io.prometheus.openmetrics2.suffixes.suffixes=falseas the default so OM2 preserves names exactly as registered.suffixes=true, append missing unit suffixes and_totalfor counters.Fixes #2518.
Why
OpenMetrics 2.0 uses a "name in, name out" model. For example:
OM2 exposes this as
requestsby default. Existing client_java applications may rely on the OM1-style exposition namerequests_bytes_total, so switching formats can otherwise rename series and affect queries, alerts, recording rules, and dashboards.Applications that need a gradual migration can temporarily enable compatibility naming:
io.prometheus.openmetrics2.suffixes=trueThis exposes
requests_bytes_totalwhile producers and downstream consumers migrate. Once registrations use the intended names explicitly, compatibility mode can be disabled without changing the exposed series.Implementation
When compatibility naming is enabled, the writer reuses
MetricMetadata.expositionBaseName, which contains the normalized unit suffix and preserves explicitly provided suffixes. Counter names receive_totalonly when it is missing.The existing OpenMetrics 1.0 summary-writing flow is reused with the selected metric name so summary metadata and samples follow the same configuration.
Validation
All current GitHub Actions checks pass, including build, lint, API diff, Java compatibility, integration, native, and acceptance tests.