Accept header mismatch for OpenMetrics
See original GitHub issueThe latest
(2.30.0) version of Prometheus sends out the following request when scraping:
GET /actuator/prometheus HTTP/1.1
Host: host.docker.internal:8080
User-Agent: Prometheus/2.30.0
Accept: application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1
Accept-Encoding: gzip
X-Prometheus-Scrape-Timeout-Seconds: 10
In the Accept
header, the version of openmetrics-text
is 0.0.1
(see scrape.go
).
In the Java client, the Content-Type
constant does not match to this, its version is 1.0.0
(see TextFormat
):
CONTENT_TYPE_OPENMETRICS_100 = "application/openmetrics-text; version=1.0.0; charset=utf-8";
The python client uses 0.0.1
too. Shouldn’t all use the same version (1.0.0
) or should the Java client use (0.0.1
)?
It also seems that TextFormat::chooseContentType
takes this into account:
https://github.com/prometheus/client_java/blob/7a29af04821cd51592c45ce4682c3132372f4c5d/simpleclient_common/src/main/java/io/prometheus/client/exporter/common/TextFormat.java#L37-L41
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Accept header mismatch for OpenMetrics · Issue #9430 - GitHub
Scraping the Prometheus endpoint of a service. What did you expect to see? Prometheus uses the following Accept header: Accept: application/ ...
Read more >HTTP Tests - Datadog Docs
HTTP tests allow you to send HTTP requests to your applications' API endpoints to verify ... Request headers: Define headers to add to...
Read more >406 when exception thrown in Spring controller with accept ...
In your case the Accept header carries text/csv but server responds with application/json , thus the 406 error because there is a clear...
Read more >Metrics for Eclipse MicroProfile
OpenMetrics text format - used when the HTTP Accept header best matches ... HTTP Accept header for an OPTIONS request does not match...
Read more >Accept header mismatch for OpenMetrics - IssueHint
In the Accept header, the version of openmetrics-text is 0.0.1 (see scrape.go ). In the Java client, the Content-Type constant does not match...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I agree, too. According to the OpenMetrics Spec:
Fixed in https://github.com/prometheus/prometheus/pull/9431