Skip to content

feat: Add OpenMetrics2 enabled flag - #1953

Merged
zeitlinger merged 1 commit into
mainfrom
om2-enabled-flag
Mar 18, 2026
Merged

feat: Add OpenMetrics2 enabled flag#1953
zeitlinger merged 1 commit into
mainfrom
om2-enabled-flag

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Mar 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Add io.prometheus.openmetrics2.enabled as the explicit gate for OM2
    writer selection. Feature flags alone no longer activate OM2.
  • enableOpenMetrics2() programmatic configurator sets enabled=true
    implicitly.
  • Prerequisite for Move suffix handling from creation time to scrape time #1942 — gives users a clean way to opt into OM2's
    name-preservation behavior without committing to other OM2 features.

Test plan

  • OpenMetrics2PropertiesTest covers enabled in load, builder,
    enableAll, defaultValues
  • ExpositionFormatsTest verifies OM2 activation requires
    enabled=true, feature flags alone fall back to OM1
  • Full build + test suite passes

BEGIN_COMMIT_OVERRIDE
chore: Add OpenMetrics2 enabled flag
END_COMMIT_OVERRIDE

The OM2 writer selection previously activated when any feature flag was
set, but there was no way to just enable OM2 without opting into a
specific feature. This adds an explicit `enabled` gate
(io.prometheus.openmetrics2.enabled) as the single control for OM2
writer selection. Feature flags alone no longer activate OM2.

The programmatic `enableOpenMetrics2()` configurator sets enabled=true
implicitly, matching its name.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
zeitlinger merged commit ffa0d39 into main Mar 18, 2026
14 checks passed
@zeitlinger
zeitlinger deleted the om2-enabled-flag branch March 18, 2026 07:28
This was referenced Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants