Title: feat: add OpenMetrics2TextFormatWriter skeleton · Issue #1948 · prometheus/client_java · GitHub
Open Graph Title: feat: add OpenMetrics2TextFormatWriter skeleton · Issue #1948 · prometheus/client_java
X Title: feat: add OpenMetrics2TextFormatWriter skeleton · Issue #1948 · prometheus/client_java
Description: Part of #1912. Depends on #1939 (merged). Blocks content negotiation (PR 1) and OM2 suffix handling in #1947. Motivation The OM2 feature flags from #1939 exist but there's no OM2 writer to apply them to. Content negotiation and suffix ha...
Open Graph Description: Part of #1912. Depends on #1939 (merged). Blocks content negotiation (PR 1) and OM2 suffix handling in #1947. Motivation The OM2 feature flags from #1939 exist but there's no OM2 writer to apply th...
X Description: Part of #1912. Depends on #1939 (merged). Blocks content negotiation (PR 1) and OM2 suffix handling in #1947. Motivation The OM2 feature flags from #1939 exist but there's no OM2 writer to appl...
Opengraph URL: https://github.com/prometheus/client_java/issues/1948
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: add OpenMetrics2TextFormatWriter skeleton","articleBody":"Part of #1912. Depends on #1939 (merged).\nBlocks content negotiation (PR 1) and OM2 suffix handling in #1947.\n\n## Motivation\n\nThe OM2 feature flags from #1939 exist but there's no OM2 writer\nto apply them to. Content negotiation and suffix handling both need\nan OM2 writer class to land their changes in.\n\n## Scope\n\n1. **`OpenMetrics2TextFormatWriter`** implementing `ExpositionFormatWriter`\n - Start as copy of OM1 writer (identical output)\n - `CONTENT_TYPE = \"application/openmetrics-text; version=2.0.0; charset=utf-8\"`\n - `accepts()` same as OM1 (matches any OpenMetrics accept) — no version gating\n - Takes `OpenMetrics2Properties` from #1939 in builder\n\n2. **Wire into `ExpositionFormats`**\n - Add field + accessor\n - When OM2 is enabled: `findWriter()` prefers OM2 over OM1\n - When OM2 is not enabled: OM2 writer is not used\n\n3. **No new suffix logic, no composite values, no native histograms**\n\n## Testability\n\nWith OM2 enabled and `contentNegotiation=false` (default), the OM2\nwriter is always selected for OpenMetrics requests — masquerades as\nOM1 so it's testable with current Prometheus.\n\nContent negotiation then gates it: only route to OM2 when the\nscraper sends `version=2.0.0`.\n\n**Open question:** Does Prometheus reject responses with\n`Content-Type: ...; version=2.0.0` when it asked for OM1? If so,\nuse the OM1 content type string when `contentNegotiation=false`.","author":{"url":"https://github.com/zeitlinger","@type":"Person","name":"zeitlinger"},"datePublished":"2026-03-16T07:57:17Z","url":"https://github.com/prometheus/client_java/issues/1948"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:db69229e-c634-d83a-d7a9-beea466e88f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D5B0:F3916:15FF26:1E6CA7:6AFBBC14 |
| html-safe-nonce | afe8fa6f797f9d18c5073a3642c9d4e0ff3cfda553d35642ce19230b4e4f42f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUIwOkYzOTE2OjE1RkYyNjoxRTZDQTc6NkFGQkJDMTQiLCJ2aXNpdG9yX2lkIjoiNjg3OTkwMjUwODg3Nzg1NTc2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 83d697baa32385688d0d84a6fd6653eea8f8bf613e9e4c3a5652dd0426dc677f |
| hovercard-subject-tag | issue:4080847273 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/prometheus/client_java/1948/issue_layout |
| twitter:image | https://opengraph.githubassets.com/709b0665132ccdedf33d17e3d4ef2cedc62220a91e535f67fb74d30104cee1ed/prometheus/client_java/issues/1948 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/709b0665132ccdedf33d17e3d4ef2cedc62220a91e535f67fb74d30104cee1ed/prometheus/client_java/issues/1948 |
| og:image:alt | Part of #1912. Depends on #1939 (merged). Blocks content negotiation (PR 1) and OM2 suffix handling in #1947. Motivation The OM2 feature flags from #1939 exist but there's no OM2 writer to apply th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zeitlinger |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/prometheus/client_java git https://github.com/prometheus/client_java.git |
| octolytics-dimension-user_id | 3380462 |
| octolytics-dimension-user_login | prometheus |
| octolytics-dimension-repository_id | 7997879 |
| octolytics-dimension-repository_nwo | prometheus/client_java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7997879 |
| octolytics-dimension-repository_network_root_nwo | prometheus/client_java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width