You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PR #570, support for UTF-8 metric name escaping was introduced. This started to alter headers with extra parameters like escaping=allow-utf-8.
Because format strings now had dynamic parameters (like ; escaping=...), direct string equality checks (if format == expfmt.FmtText) started failing in downstream code and tests. To stop users from doing string comparisons, PR #576: Unexport Format strings
unexported all Fmt... constants (making them fmtText, fmtProtoDelim, etc.) and introduced FormatType enum (TypeTextPlain, TypeProtoDelim) along with expfmt.NewFormat(FormatType).
Making things private immediately broke Kubernetes (k8s.io/component-base) and large portions of the Go Prometheus ecosystem. In response, PR #665: Revert #576 and add deprecation notice re-exported the constants, but marked every single one with Deprecated:. Since then community either updated to a NewFormat, or ignored the lint warnings.
In feat: implement gauge and counter support for OpenMetrics 2.0 #894 we introduced NegotiateAccept(h, FmtProtoDelim, FmtProtoText, FmtProtoCompact, FmtText) that allows full granularity of choices to accept. We couldn't use FormatType because it does not encapsulate version.
As a result NegotiateAccept API is now quite hard to use.
Problem
escaping=allow-utf-8.; escaping=...), direct string equality checks (ifformat == expfmt.FmtText) started failing in downstream code and tests. To stop users from doing string comparisons, PR #576: Unexport Format stringsunexported all Fmt... constants (making them fmtText, fmtProtoDelim, etc.) and introduced FormatType enum (TypeTextPlain, TypeProtoDelim) along with expfmt.NewFormat(FormatType).
Deprecated:. Since then community either updated to a NewFormat, or ignored the lint warnings.NegotiateAccept(h, FmtProtoDelim, FmtProtoText, FmtProtoCompact, FmtText)that allows full granularity of choices to accept. We couldn't useFormatTypebecause it does not encapsulate version.As a result
NegotiateAcceptAPI is now quite hard to use.Examples of the current usage:
Goal
NegotiateAcceptis easier to use, especially on the hot path and for the known format sets