From 2abaae1dae514d173a035bc3251021419770f902 Mon Sep 17 00:00:00 2001 From: Peter Deng Date: Thu, 18 Mar 2021 14:40:26 +0800 Subject: [PATCH 1/3] accept text/plain type by default for prometheus client scraping --- metricbeat/helper/prometheus/prometheus.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metricbeat/helper/prometheus/prometheus.go b/metricbeat/helper/prometheus/prometheus.go index 0add9edd9bb..e4ab421ca3c 100644 --- a/metricbeat/helper/prometheus/prometheus.go +++ b/metricbeat/helper/prometheus/prometheus.go @@ -35,7 +35,11 @@ import ( "github.com/elastic/beats/v7/metricbeat/mb" ) -const acceptHeader = `application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` +const ( + promTextHeader = `text/plain;version=0.0.4;q=0.5,*/*;q=0.1` + openmetricsHeader = `application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` + acceptHeader = promTextHeader +) // Prometheus helper retrieves prometheus formatted metrics type Prometheus interface { From 3512e9d893fe99dc082c4a725a691523824edb6a Mon Sep 17 00:00:00 2001 From: Peter Deng Date: Mon, 22 Mar 2021 10:05:25 +0800 Subject: [PATCH 2/3] update CHANGELOG.next.asciidoc --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 67b7067afa3..533879488d9 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -525,6 +525,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix GCP not able to request Cloudfunctions metrics if a region filter was set {pull}24218[24218] - Fix type of `uwsgi.status.worker.rss` type. {pull}24468[24468] - Ignore unsupported derive types for filesystem metricset. {issue}22501[22501] {pull}24502[24502] +- Accept text/plain type by default for prometheus client scraping. {pull}24622[24622] *Packetbeat* From 307060b2c3fc37851e520a44a6e4a4638101020d Mon Sep 17 00:00:00 2001 From: Peter Deng Date: Wed, 24 Mar 2021 19:44:40 +0800 Subject: [PATCH 3/3] update header --- metricbeat/helper/prometheus/prometheus.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/metricbeat/helper/prometheus/prometheus.go b/metricbeat/helper/prometheus/prometheus.go index e4ab421ca3c..3568310466e 100644 --- a/metricbeat/helper/prometheus/prometheus.go +++ b/metricbeat/helper/prometheus/prometheus.go @@ -35,11 +35,7 @@ import ( "github.com/elastic/beats/v7/metricbeat/mb" ) -const ( - promTextHeader = `text/plain;version=0.0.4;q=0.5,*/*;q=0.1` - openmetricsHeader = `application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1` - acceptHeader = promTextHeader -) +const acceptHeader = `text/plain;version=0.0.4;q=0.5,*/*;q=0.1` // Prometheus helper retrieves prometheus formatted metrics type Prometheus interface {