Skip to content

Commit

Permalink
fix: Remove any content type from prometheus accept header (#11082)
Browse files Browse the repository at this point in the history
In #6745, the prometheus accept header was changed to accept any media
type. However, our prometheus plugin only accepts text. With the release
of newer versions of prometheus, the OpenMetrics type is now available
and could potentially be setup as the exclusive response type. As this
new content type is not supported, Telegraf should not accept it.

The original issue, #6523, was filed around getting a 406. The issue had
comments from the rabbit-mq maintainers who made changes to their code
to be less regid resolving the issue. The change to telegraf was made
afterwards anyway.

fixes: #10248
  • Loading branch information
powersj committed May 24, 2022
1 parent b5e5f4c commit 596b0e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/inputs/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
parserV2 "github.com/influxdata/telegraf/plugins/parsers/prometheus"
)

const acceptHeader = `application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.7,text/plain;version=0.0.4;q=0.3,*/*;q=0.1`
const acceptHeader = `application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.7,text/plain;version=0.0.4;q=0.3`

type Prometheus struct {
// An array of urls to scrape metrics from.
Expand Down

0 comments on commit 596b0e1

Please sign in to comment.