Skip to content

docs: Document OM2 #2059

Merged
zeitlinger merged 2 commits intoprometheus:mainfrom
zeitlinger:codex/om2-docs
Apr 28, 2026
Merged

docs: Document OM2 #2059
zeitlinger merged 2 commits intoprometheus:mainfrom
zeitlinger:codex/om2-docs

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Fixes #1954.

Summary

This adds the OpenMetrics 2.0 preview documentation and clarifies related naming behavior.

  • Add a dedicated OpenMetrics 2.0 preview page covering enablement, name preservation, feature flags, content negotiation, and native histograms.
  • Describe io.prometheus.openmetrics2.enabled by its observable behavior: metric names are preserved as written by the application.
  • Clarify that OM1/Prometheus text still apply suffix behavior, while OM2 does not append _total or unit suffixes automatically.
  • Document the OpenTelemetry exporter preserve_names option.

Notes

The behavior fix is split into #2058. This PR is docs-only.

Validation

  • mise run lint
  • git diff --check

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger changed the title docs: Document OM2 name preservation docs: Document OM2 Apr 27, 2026
@zeitlinger zeitlinger marked this pull request as ready for review April 27, 2026 08:29
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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@zeitlinger zeitlinger merged commit 45d753c into prometheus:main Apr 28, 2026
9 checks passed
@zeitlinger zeitlinger deleted the codex/om2-docs branch April 28, 2026 12:42
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.

OM2: docs: Document OpenMetrics 2.0 preview and OTel preserve_names flag

2 participants