Uh oh!
There was an error while loading. Please reload this page.
feat: Add skeleton OpenMetrics2TextFormatWriter - #1951
Conversation
Signed-off-by: Jay DeLuca <jaydeluca4@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a first-pass OpenMetrics 2.0 text writer and wires it into format selection so OM2 can be preferred when OM2 feature flags are enabled (while currently emitting OM1-identical output for compatibility).
Changes:
- Introduce
OpenMetrics2TextFormatWriter(OM2 skeleton) with configurable content-type behavior based onOpenMetrics2Properties. - Update
ExpositionFormatsto construct/expose the OM2 writer and prefer it over OM1 when any OM2 flag is enabled. - Add unit tests for OM2 writer content-type behavior and OM1/OM2 output equivalence; extend
ExpositionFormatsTestfor OM2 selection.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/OpenMetrics2TextFormatWriter.java | New OM2 writer (currently OM1-equivalent output) + content-type switching via OM2 properties. |
| prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormats.java | Construct/expose OM2 writer; prefer OM2 over OM1 when OM2 flags enabled; add init(PrometheusProperties) and deprecate old init. |
| prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusScrapeHandler.java | Switch to initializing ExpositionFormats with full PrometheusProperties. |
| prometheus-metrics-exposition-textformats/src/test/java/io/prometheus/metrics/expositionformats/OpenMetrics2TextFormatWriterTest.java | New tests for OM2 content-type behavior and output parity with OM1. |
| prometheus-metrics-exposition-textformats/src/test/java/io/prometheus/metrics/expositionformats/ExpositionFormatsTest.java | Add OM2 writer existence + selection/preference tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Jay DeLuca <jaydeluca4@gmail.com>
| private boolean isOpenMetrics2Enabled() { | ||
| OpenMetrics2Properties props = openMetrics2TextFormatWriter.getOpenMetrics2Properties(); | ||
| return props.getContentNegotiation() |
There was a problem hiding this comment.
note: need to add another one if you just want to have the features from #1942
Closes#1948
BEGIN_COMMIT_OVERRIDE
chore: Add skeleton OpenMetrics2TextFormatWriter
END_COMMIT_OVERRIDE