Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMAgent can't scrape application without header: Accept: text/plain #608

Closed
to4kin opened this issue Jul 7, 2020 · 2 comments
Closed

VMAgent can't scrape application without header: Accept: text/plain #608

to4kin opened this issue Jul 7, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@to4kin
Copy link

to4kin commented Jul 7, 2020

Describe the bug
One of my springboot applications return metrics only if the correct header set:

curl -v localhost:9080/actuator/prometheus

* Connected to localhost (::1) port 9080 (#0)
> GET /actuator/prometheus HTTP/1.1
> Host: localhost:9080
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 406
< Content-Length: 0
< Date: Tue, 07 Jul 2020 15:55:26 GMT
<
* Connection #0 to host localhost left intact

curl -v -H "Accept: text/plain" localhost:9080/actuator/prometheus

* Connected to localhost (::1) port 9080 (#0)
> GET /actuator/prometheus HTTP/1.1
> Host: localhost:9080
> User-Agent: curl/7.64.0
> Accept: text/plain
>
< HTTP/1.1 200
< Content-Type: text/plain; version=0.0.4;charset=utf-8
< Content-Length: 17870
< Vary: Accept-Encoding
< Date: Tue, 07 Jul 2020 15:56:28 GMT
<

curl http://vmagent-host:8429/targets

state=down, endpoint=http://<IP:PORT>/actuator/prometheus, labels={application="NAME", instance="INSTANCE-NAME", job="JOB-NAME"}, last_scrape=24.894s ago, scrape_duration=0.005s, error="unexpected status code returned when scraping \"http://<IP:PORT>/actuator/prometheus\": 406; expecting 200; response body: \"\""

VMAgent cannot scrape these metrics when prometheus can

To Reproduce
Same issue in Prometheus: prometheus/client_java#267

Expected behavior
VMAgent should scrape this application too

Version
The line returned when passing --version command line flag to binary. For example:

$ ./victoria-metrics-prod --version
vmagent-20200702-100247-tags-v1.37.4-cluster-0-g0f754bea4

Used command-line flags
/vmagent-prod -remoteWrite.url=http://victoria-metrics-vminsert:8480/insert/0/prometheus/ -promscrape.consulSDCheckInterval=30s -promscrape.suppressScrapeErrors -promscrape.config=/vmagent-remotewrite-data/scrape.yml

@valyala valyala added the bug Something isn't working label Jul 8, 2020
valyala added a commit that referenced this issue Jul 8, 2020
…ing targets

This should fix scraping Spring Boot servers, which return incorrect response
unless `Accept: text/plain` request header is set.

See #608
valyala added a commit that referenced this issue Jul 8, 2020
…ing targets

This should fix scraping Spring Boot servers, which return incorrect response
unless `Accept: text/plain` request header is set.

See #608
@valyala
Copy link
Collaborator

valyala commented Jul 8, 2020

@to4kin , the issue should be fixed in the commit 87f8c72 . Could you build vmagent from this commit according to these docs and verify whether it now properly scrapes Spring Boot servers?

@valyala
Copy link
Collaborator

valyala commented Jul 8, 2020

@to4kin , the bugfix has been included in v1.38.0 release. Closing the issue as fixed. Feel free re-opening if v1.38.0 or newer release of vmagent doesn't work as expected for your case.

@valyala valyala closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants