1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-16 14:27:01 +00:00

expvarom: Use application/openmetrics-text as content type

The openmetrics proposed standard says we should use the
`application/openmetrics-text` content type when exporting the metrics.

Currently we use `text/plain` for backwards compatibility with
Prometheus, but the new content type is apparently supported since 2018,
so it should be safe to update to match the current proposed standard.
This commit is contained in:
Alberto Bertogli
2021-06-11 12:44:46 +01:00
parent 8c8e64dc29
commit 099e2e2269

View File

@@ -53,11 +53,8 @@ var (
// MetricsHandler implements an http.HandlerFunc which serves the registered
// metrics, using the OpenMetrics text-based format.
func MetricsHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; version=0.0.4")
// Update to this once it's standard and Prometheus and other ingesters
// can handle this.
//w.Header().Set("Content-Type", "application/openmetrics-text; version=1.0.0; charset=utf-8")
w.Header().Set("Content-Type",
"application/openmetrics-text; version=1.0.0; charset=utf-8")
vars := []exportedVar{}
ignored := []string{}