expfmt: fix OpenMetrics 2.0 decoder error, format docs, and encoder version dispatch - #968
Open
dashpole wants to merge 3 commits into
Open
expfmt: fix OpenMetrics 2.0 decoder error, format docs, and encoder version dispatch#968dashpole wants to merge 3 commits into
dashpole wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR applies follow-up fixes and clarifications to the expfmt OpenMetrics 2.0 support introduced in #894, focusing on correct format/version dispatch, clearer “encode-only experimental” messaging, and more explicit decode behavior for OpenMetrics 2.0.
Changes:
- Make
NewEncoder(andNewDecoderfor OpenMetrics) usemime.ParseMediaTypeso version parameters are correctly handled even with standard MIME quoting/spacing. - Return an explicit “not supported for decoding” error from
NewDecoderfor OpenMetricsversion=2.0.0. - Clarify documentation around OpenMetrics 2.0’s experimental/encode-only status and option handling; add tests covering the new dispatch/error behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| expfmt/openmetrics_2_0_create.go | Clarifies OpenMetrics 2.0 encoder documentation and explicitly ignores encoder options. |
| expfmt/expfmt.go | Documents experimental/encode-only status in OpenMetrics format construction and comments. |
| expfmt/encode.go | Uses mime.ParseMediaType to dispatch OpenMetrics encoding by version parameter reliably. |
| expfmt/encode_test.go | Adds coverage ensuring OpenMetrics 2.0 encoder dispatch works with reordered/quoted MIME params. |
| expfmt/decode.go | Returns an explicit unsupported decode error for OpenMetrics 2.0 based on version parameter. |
| expfmt/decode_test.go | Adds coverage verifying NewDecoder errors for OpenMetrics 2.0 and succeeds/falls back elsewhere. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dashpole
force-pushed
the
fix-om20-decoder-and-format
branch
from
August 24, 2026 16:40
0fe3bb8 to
2b4b2f8
Compare
…ersion dispatch - Return unsupported format error in NewDecoder for OpenMetrics 2.0. - Clarify experimental encode-only status and ignored EncoderOptions in doc comments. - Use mime.ParseMediaType in NewEncoder for clean version dispatch. Signed-off-by: David Ashpole <dashpole@google.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: David Ashpole <dashpole@google.com>
…0 doc comments Signed-off-by: David Ashpole <dashpole@google.com>
dashpole
force-pushed
the
fix-om20-decoder-and-format
branch
from
August 24, 2026 17:50
2b4b2f8 to
263defe
Compare
dashpole
marked this pull request as ready for review
August 24, 2026 17:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some small follow-ups to the OpenMetrics 2.0 support introduced by #894.
application/openmetrics-text; version="2.0.0").