From 54ce07e9a0e96aa781bec4a34110204db89b0ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Rabenstein?= Date: Mon, 7 Nov 2022 18:22:03 +0100 Subject: [PATCH] scrape: Fix accept header (#11542) First of all, there was a typo: `encoding=delimited` was a left-over in the `scrapeAcceptHeader`. Second, the recently updated `version=1.0.0` prevents current versions of client_golang to negotiate OpenMetrics, as they expect `version=0.0.1` or no version at all. This commit adds, with lower priority, the latter (no version at all) to the accept header. Fixes #11540, Signed-off-by: beorn7 --- scrape/scrape.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrape/scrape.go b/scrape/scrape.go index 8a664bf73..0421b51cb 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -773,8 +773,8 @@ type targetScraper struct { var errBodySizeLimit = errors.New("body size limit exceeded") const ( - scrapeAcceptHeader = `encoding=delimited,application/openmetrics-text;version=1.0.0;q=0.75,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` - scrapeAcceptHeaderWithProtobuf = `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited,application/openmetrics-text;version=1.0.0;q=0.75,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` + scrapeAcceptHeader = `application/openmetrics-text;version=1.0.0;q=0.75,application/openmetrics-text;q=0.6,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` + scrapeAcceptHeaderWithProtobuf = `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited,application/openmetrics-text;version=1.0.0;q=0.75,application/openmetrics-text;q=0.6,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` ) var UserAgent = fmt.Sprintf("Prometheus/%s", version.Version)