question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accept header mismatch for OpenMetrics

See original GitHub issue

The 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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
fstabcommented, Oct 1, 2021

I agree, too. According to the OpenMetrics Spec:

The content type MUST be: application/openmetrics-text; version=1.0.0; charset=utf-8

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found