Skip to content

feat: Add OM2 native histogram text output#2042

Merged
zeitlinger merged 6 commits intoprometheus:mainfrom
zeitlinger:codex/om2-native-histograms
Apr 25, 2026
Merged

feat: Add OM2 native histogram text output#2042
zeitlinger merged 6 commits intoprometheus:mainfrom
zeitlinger:codex/om2-native-histograms

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

Adds OpenMetrics 2.0 text output for native histograms behind the nativeHistograms flag.

  • serializes native histogram fields (schema, zero_threshold, zero_count, native spans/buckets)
  • supports native gauge histograms with gcount/gsum
  • supports mixed native + classic histograms with classic bucket output last
  • emits all histogram exemplars on composite/native histogram samples
  • adds unit/integration coverage for native histogram content negotiation and edge cases

Validation

  • ./mvnw test -pl prometheus-metrics-exposition-textformats -Dtest=OpenMetrics2TextFormatWriterTest,ExpositionFormatsTest -Dcoverage.skip=true -Dcheckstyle.skip=true
  • mise run build

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger changed the title [codex] Add OM2 native histogram text output feant: Add OM2 native histogram text output Apr 23, 2026
@zeitlinger zeitlinger changed the title feant: Add OM2 native histogram text output feat: Add OM2 native histogram text output Apr 23, 2026
@zeitlinger zeitlinger marked this pull request as ready for review April 23, 2026 09:11
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
… codex/om2-native-histograms

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>

# Conflicts:
#	prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/OpenMetrics2TextFormatWriter.java
#	prometheus-metrics-exposition-textformats/src/test/java/io/prometheus/metrics/expositionformats/OpenMetrics2TextFormatWriterTest.java
@zeitlinger zeitlinger merged commit dec8e5b into prometheus:main Apr 25, 2026
14 checks passed
@zeitlinger zeitlinger deleted the codex/om2-native-histograms branch April 25, 2026 20:44
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.

2 participants