docs: Document OM2 #2059
Merged
zeitlinger merged 2 commits intoprometheus:mainfrom Apr 28, 2026
Merged
Conversation
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
jaydeluca
reviewed
Apr 27, 2026
Comment on lines
+20
to
+33
| ```properties | ||
| io.prometheus.openmetrics2.enabled=true | ||
| ``` | ||
|
|
||
| Programmatic configuration: | ||
|
|
||
| ```java | ||
| PrometheusProperties properties = PrometheusProperties.builder() | ||
| .enableOpenMetrics2(om2 -> om2.contentNegotiation(true)) | ||
| .build(); | ||
| ``` | ||
|
|
||
| Enabling `enableOpenMetrics2(...)` also enables the top-level `enabled` flag automatically, so you | ||
| only need to configure the sub-flags you want. |
Collaborator
There was a problem hiding this comment.
fairly minor, but should these two examples match?
For example, either adding io.prometheus.openmetrics2.content_negotiation=true to the properties file example, or removing the content negotiation from the programmatic one?
PrometheusProperties properties = PrometheusProperties.builder()
.enableOpenMetrics2(om2 -> {})
.build();
Member
Author
There was a problem hiding this comment.
Aligned the examples in both directions. The first pair now shows the minimal enablement case without content negotiation, and I added a separate properties/programmatic pair for content_negotiation=true / contentNegotiation(true).
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
jaydeluca
approved these changes
Apr 28, 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.
Fixes #1954.
Summary
This adds the OpenMetrics 2.0 preview documentation and clarifies related naming behavior.
io.prometheus.openmetrics2.enabledby its observable behavior: metric names are preserved as written by the application._totalor unit suffixes automatically.preserve_namesoption.Notes
The behavior fix is split into #2058. This PR is docs-only.
Validation
mise run lintgit diff --check