diff --git a/CHANGELOG.md b/CHANGELOG.md index b5cb893bab..89d540eaf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## unreleased +## 3.2.1 / 2025-02-25 + +* [BUGFIX] Don't send Accept` header `escape=allow-utf-8` when `metric_name_validation_scheme: legacy` is configured. #16061 ## 3.2.0 / 2025-02-17 diff --git a/VERSION b/VERSION index 944880fa15..e4604e3afd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0 +3.2.1 diff --git a/config/config.go b/config/config.go index 73282ac429..465affe082 100644 --- a/config/config.go +++ b/config/config.go @@ -523,7 +523,7 @@ var ( ScrapeProtocolsHeaders = map[ScrapeProtocol]string{ PrometheusProto: "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited", PrometheusText0_0_4: "text/plain;version=0.0.4", - PrometheusText1_0_0: "text/plain;version=1.0.0;escaping=allow-utf-8", + PrometheusText1_0_0: "text/plain;version=1.0.0", OpenMetricsText0_0_1: "application/openmetrics-text;version=0.0.1", OpenMetricsText1_0_0: "application/openmetrics-text;version=1.0.0", } diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index 26117ffd08..75fed524c4 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -2825,6 +2825,8 @@ func TestTargetScraperScrapeOK(t *testing.T) { accept := r.Header.Get("Accept") if allowUTF8 { require.Containsf(t, accept, "escaping=allow-utf-8", "Expected Accept header to allow utf8, got %q", accept) + } else { + require.NotContainsf(t, accept, "escaping=allow-utf-8", "Expected Accept header to not allow utf8, got %q", accept) } if protobufParsing { require.True(t, strings.HasPrefix(accept, "application/vnd.google.protobuf;"), @@ -2860,7 +2862,7 @@ func TestTargetScraperScrapeOK(t *testing.T) { panic(err) } - runTest := func(acceptHeader string) { + runTest := func(t *testing.T, acceptHeader string) { ts := &targetScraper{ Target: &Target{ labels: labels.FromStrings( @@ -2887,14 +2889,43 @@ func TestTargetScraperScrapeOK(t *testing.T) { require.Equal(t, "metric_a 1\nmetric_b 2\n", buf.String()) } - runTest(acceptHeader(config.DefaultScrapeProtocols, model.LegacyValidation)) - protobufParsing = true - runTest(acceptHeader(config.DefaultProtoFirstScrapeProtocols, model.LegacyValidation)) - protobufParsing = false - allowUTF8 = true - runTest(acceptHeader(config.DefaultScrapeProtocols, model.UTF8Validation)) - protobufParsing = true - runTest(acceptHeader(config.DefaultProtoFirstScrapeProtocols, model.UTF8Validation)) + for _, tc := range []struct { + scrapeProtocols []config.ScrapeProtocol + scheme model.ValidationScheme + protobufParsing bool + allowUTF8 bool + }{ + { + scrapeProtocols: config.DefaultScrapeProtocols, + scheme: model.LegacyValidation, + protobufParsing: false, + allowUTF8: false, + }, + { + scrapeProtocols: config.DefaultProtoFirstScrapeProtocols, + scheme: model.LegacyValidation, + protobufParsing: true, + allowUTF8: false, + }, + { + scrapeProtocols: config.DefaultScrapeProtocols, + scheme: model.UTF8Validation, + protobufParsing: false, + allowUTF8: true, + }, + { + scrapeProtocols: config.DefaultProtoFirstScrapeProtocols, + scheme: model.UTF8Validation, + protobufParsing: true, + allowUTF8: true, + }, + } { + t.Run(fmt.Sprintf("%+v", tc), func(t *testing.T) { + protobufParsing = tc.protobufParsing + allowUTF8 = tc.allowUTF8 + runTest(t, acceptHeader(tc.scrapeProtocols, tc.scheme)) + }) + } } func TestTargetScrapeScrapeCancel(t *testing.T) { diff --git a/web/ui/mantine-ui/package.json b/web/ui/mantine-ui/package.json index 636f827c8a..aea0edf751 100644 --- a/web/ui/mantine-ui/package.json +++ b/web/ui/mantine-ui/package.json @@ -1,7 +1,7 @@ { "name": "@prometheus-io/mantine-ui", "private": true, - "version": "0.302.0", + "version": "0.302.1", "type": "module", "scripts": { "start": "vite", @@ -28,7 +28,7 @@ "@microsoft/fetch-event-source": "^2.0.1", "@nexucis/fuzzy": "^0.5.1", "@nexucis/kvsearch": "^0.9.1", - "@prometheus-io/codemirror-promql": "0.302.0", + "@prometheus-io/codemirror-promql": "0.302.1", "@reduxjs/toolkit": "^2.5.0", "@tabler/icons-react": "^3.28.1", "@tanstack/react-query": "^5.62.11", diff --git a/web/ui/module/codemirror-promql/package.json b/web/ui/module/codemirror-promql/package.json index 457f644905..ccc9da7471 100644 --- a/web/ui/module/codemirror-promql/package.json +++ b/web/ui/module/codemirror-promql/package.json @@ -1,6 +1,6 @@ { "name": "@prometheus-io/codemirror-promql", - "version": "0.302.0", + "version": "0.302.1", "description": "a CodeMirror mode for the PromQL language", "types": "dist/esm/index.d.ts", "module": "dist/esm/index.js", @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/prometheus/prometheus/blob/main/web/ui/module/codemirror-promql/README.md", "dependencies": { - "@prometheus-io/lezer-promql": "0.302.0", + "@prometheus-io/lezer-promql": "0.302.1", "lru-cache": "^11.0.2" }, "devDependencies": { diff --git a/web/ui/module/lezer-promql/package.json b/web/ui/module/lezer-promql/package.json index a358151da1..b4f1a793a6 100644 --- a/web/ui/module/lezer-promql/package.json +++ b/web/ui/module/lezer-promql/package.json @@ -1,6 +1,6 @@ { "name": "@prometheus-io/lezer-promql", - "version": "0.302.0", + "version": "0.302.1", "description": "lezer-based PromQL grammar", "main": "dist/index.cjs", "type": "module", diff --git a/web/ui/package-lock.json b/web/ui/package-lock.json index 1fffce00e7..8ec10d35c9 100644 --- a/web/ui/package-lock.json +++ b/web/ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "prometheus-io", - "version": "0.302.0", + "version": "0.302.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "prometheus-io", - "version": "0.302.0", + "version": "0.302.1", "workspaces": [ "mantine-ui", "module/*" @@ -24,7 +24,7 @@ }, "mantine-ui": { "name": "@prometheus-io/mantine-ui", - "version": "0.302.0", + "version": "0.302.1", "dependencies": { "@codemirror/autocomplete": "^6.18.4", "@codemirror/language": "^6.10.8", @@ -42,7 +42,7 @@ "@microsoft/fetch-event-source": "^2.0.1", "@nexucis/fuzzy": "^0.5.1", "@nexucis/kvsearch": "^0.9.1", - "@prometheus-io/codemirror-promql": "0.302.0", + "@prometheus-io/codemirror-promql": "0.302.1", "@reduxjs/toolkit": "^2.5.0", "@tabler/icons-react": "^3.28.1", "@tanstack/react-query": "^5.62.11", @@ -146,10 +146,10 @@ }, "module/codemirror-promql": { "name": "@prometheus-io/codemirror-promql", - "version": "0.302.0", + "version": "0.302.1", "license": "Apache-2.0", "dependencies": { - "@prometheus-io/lezer-promql": "0.302.0", + "@prometheus-io/lezer-promql": "0.302.1", "lru-cache": "^11.0.2" }, "devDependencies": { @@ -179,7 +179,7 @@ }, "module/lezer-promql": { "name": "@prometheus-io/lezer-promql", - "version": "0.302.0", + "version": "0.302.1", "license": "Apache-2.0", "devDependencies": { "@lezer/generator": "^1.7.2", diff --git a/web/ui/package.json b/web/ui/package.json index 4af8447049..3e58725f57 100644 --- a/web/ui/package.json +++ b/web/ui/package.json @@ -1,7 +1,7 @@ { "name": "prometheus-io", "description": "Monorepo for the Prometheus UI", - "version": "0.302.0", + "version": "0.302.1", "private": true, "scripts": { "build": "bash build_ui.sh --all",