Repository navigation
expfmt: support Prometheus text format 1.0.0 - #1035
Conversation
Assisted-by: Codex (GPT-6) Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
b35cd14 to
f382e0f
Compare
|
|
||
| case textType: | ||
| if params["version"] == TextVersion_1_0_0 { | ||
| return FmtText_1_0_0.WithEscapingScheme(Format(ct).ToEscapingScheme()) |
There was a problem hiding this comment.
Calling WithEscapingScheme unconditionally here makes ResponseFormat append ; escaping=underscores even when Content-Type: text/plain; version=1.0.0 has no escaping parameter, unlike all other formats returned by ResponseFormat. Could we only attach WithEscapingScheme when params[model.EscapingKey] is present (or do that consistently across all formats in ResponseFormat so NewDecoder preserves escaping for OpenMetrics and protobuf too)?
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
|
There's a Prometheus 1.0.0 text format? I don't see it documented: https://prometheus.io/docs/instrumenting/exposition_formats/ |
v0.73.0 (prometheus/common#1008) takes the escaping scheme only from the matching Accept clause. expfmt negotiates only text 0.0.4, so the Prometheus 3.x default scrape gets escaping=underscores and /metrics serves underscored names instead of pure OTel names. Hold until prometheus/common#1035 lands.
PR to add: prometheus/docs#3183 |
What's Changed * expfmt: add ABNF parser for OpenMetrics 2.0 by @bwplotka in #1016 * build(deps): bump ossf/scorecard-action from 2.4.4 to 2.5.0 by @dependabot[bot] in #1032 * build(deps): bump actions/upload-artifact from 7.0.1 to 7.0.2 by @dependabot[bot] in #1033 * build(deps): bump golang.org/x/net from 0.61.0 to 0.62.0 in the golang-org-x group across 1 directory by @dependabot[bot] in #1030 * expfmt: bump go-abnf to v0.5.5 by @PerryLink in #1029 * config: move Secret into its own package by @mrueg in #1024 * build(deps): bump the codeql group with 4 updates by @dependabot[bot] in #1031 * version: fix Slog godoc example to compile by @sueun-dev in #935 * build(deps): bump go.yaml.in/yaml/v2 from 2.4.4 to 2.4.5 by @dependabot[bot] in #1043 * build(deps): bump golang.org/x/oauth2 from 0.37.0 to 0.38.0 in the golang-org-x group across 1 directory by @dependabot[bot] in #1042 * expfmt: support Prometheus text format 1.0.0 by @ArthurSens in #1035 New Contributors * @PerryLink made their first contribution in #1029 * @sueun-dev made their first contribution in #935 **Full Changelog**: v0.73.1...v0.74.0 Signed-off-by: SuperQ <superq@gmail.com>
Prometheus requests UTF-8 metric names using
text/plain;version=1.0.0;escaping=allow-utf-8, but the default accepted formats only support text version 0.0.4. This causes negotiation to select 0.0.4 and underscore-escape names despite the scraper supporting UTF-8.Add Prometheus text format 1.0.0 support to negotiation, encoding, and decoding, while preserving the existing 0.0.4 fallback.
Related: open-telemetry/opentelemetry-collector-contrib#52781