-
Notifications
You must be signed in to change notification settings - Fork 158
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
Set plain/text Content-Type for prometheus exporter #496
Conversation
Encountered with the same issue when using this crate and Datadog |
I've manually applied this fix and confirmed that the Prometheus exporter is now compliant with the DataDog Prometheus scraper. Prometheus Exposition Format and Content-Type header: |
Seems reasonable to me! 👍🏻 |
Released as Thanks again for your contribution! |
When prometheus updates to v3, it is becoming stricter with the Content-Type of the response. https://prometheus.io/docs/prometheus/3.0/migration/#scrape-protocols ``` Prometheus v3 is more strict concerning the Content-Type header received when scraping. Prometheus v2 would default to the standard Prometheus text protocol if the target being scraped did not specify a Content-Type header or if the header was unparsable or unrecognised. This could lead to incorrect data being parsed in the scrape. Prometheus v3 will now fail the scrape in such cases. ``` The Content-Type is updated in dependency. So all we have to do is update the version. From the metrics/metrics-exporter-prometheus CHANGELOG.md: ``` - Update the `Content-Type` response header to `text/plain`, matching the Exposition format specification. ([AleoNet#496](metrics-rs/metrics#496)) ```
When prometheus updates to v3, it is becoming stricter with the Content-Type of the response. https://prometheus.io/docs/prometheus/3.0/migration/#scrape-protocols ``` Prometheus v3 is more strict concerning the Content-Type header received when scraping. Prometheus v2 would default to the standard Prometheus text protocol if the target being scraped did not specify a Content-Type header or if the header was unparsable or unrecognised. This could lead to incorrect data being parsed in the scrape. Prometheus v3 will now fail the scrape in such cases. ``` The Content-Type is updated in dependency. So all we have to do is update the version. From the metrics/metrics-exporter-prometheus CHANGELOG.md: ``` - Update the `Content-Type` response header to `text/plain`, matching the Exposition format specification. ([AleoNet#496](metrics-rs/metrics#496)) ```
Playing around with different tools to view metrics, I found that some tool complained about not having Content-Type text/plain. So this PR fixes that.