Conversation
bwplotka
marked this pull request as draft
September 22, 2026 15:56
liggitt
reviewed
Sep 23, 2026
liggitt
reviewed
Sep 23, 2026
bwplotka
force-pushed
the
expfmt-ergonomics
branch
from
September 25, 2026 09:18
b0a5827 to
4538372
Compare
bwplotka
force-pushed
the
expfmt-ergonomics
branch
from
September 25, 2026 09:42
4538372 to
d8e0008
Compare
- Undeprecate Fmt... constants and ProtoFmt, clarifying documentation that these represent baseline Content-Types. - Export FmtOpenMetrics_2_0_0 constant. - Add Format.Version() to extract format version parameter. - Provide DefaultAcceptedFormats(), DefaultOpenMetricsAcceptedFormats(), and DefaultOpenMetrics2AcceptedFormats() functions returning cloned slices of default formats for use with NegotiateAccept. - Deprecate Negotiate and NegotiateIncludingOpenMetrics in favor of NegotiateAccept with the respective default formats. - Clarify NewFormat documentation that the latest stable version is returned when multiple versions exist. Signed-off-by: bwplotka <bwplotka@gmail.com>
bwplotka
force-pushed
the
expfmt-ergonomics
branch
from
September 25, 2026 09:48
d8e0008 to
8cac188
Compare
bwplotka
marked this pull request as ready for review
September 25, 2026 09:53
bwplotka
commented
Sep 25, 2026
| FmtText, | ||
| } | ||
|
|
||
| defaultOpenMetricsAcceptedFormats = []Format{ |
Member
Author
There was a problem hiding this comment.
the idea is to add 2.0 once stable
Member
There was a problem hiding this comment.
Still FmtOpenMetrics_2_0_0 emits no warning (it did before)
Member
Author
There was a problem hiding this comment.
What warning you have in mind? I don't recall any in the past? Also we probably don't want to pass logger to NewEncoder 🤔
Member
|
Thank you. The direction looks good! |
Co-authored-by: Julien <291750+roidelapluie@users.noreply.github.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
dashpole
approved these changes
Sep 25, 2026
Co-authored-by: David Ashpole <dashpole@google.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
roidelapluie
approved these changes
Sep 25, 2026
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.
This PR improves the ergonomics of the
expfmtpackage without breaking backwards compatibility by simplifying format constants, exposing default format negotiation slices as cloned getters.cc @dashpole
Changes
Fmt...constants andProtoFmt: Clarify in documentation that these represent baseline Content-Types used for HTTP headers and content negotiation, while advising against direct equality comparison (==) due to dynamic parameters (like; escaping=...) and whitespace variations.NewFormatdocumentation: Clarify that the latest stable version will be returned if a format type has more than one version.Rationale: Make sure it's clear we will add
FmtOpenMetrics_2_0_0once stable.FmtOpenMetrics_2_0_0: Expose the OpenMetrics 2.0.0 constant alongside the existing OpenMetrics format constants.Rationales:
Instead:
You can:
or
Format.Version(): Provide a helper to extract the format version parameter (e.g.,"0.0.4","1.0.0","2.0.0"), or empty string if unspecified or invalid.DefaultAcceptedFormats(),DefaultOpenMetricsAcceptedFormats()returning safely cloned slices viaslices.Clone()for use withNegotiateAccept.Fixes: #993