Skip to content

Commit

Permalink
fix: Add Content-Type to /metrics response
Browse files Browse the repository at this point in the history
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))
```
  • Loading branch information
Raphexion committed Dec 3, 2024
1 parent 2cb5444 commit 5c6f835
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion node/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metrics = [ "snarkvm/metrics" ]
serial = [ "snarkvm/metrics" ]

[dependencies.metrics-exporter-prometheus]
version = "0.13"
version = "0.15"

[dependencies.parking_lot]
version = "0.12"
Expand Down

0 comments on commit 5c6f835

Please sign in to comment.