diff --git a/crates/meilisearch/src/routes/metrics.rs b/crates/meilisearch/src/routes/metrics.rs index 31abb93a7..1efd6d367 100644 --- a/crates/meilisearch/src/routes/metrics.rs +++ b/crates/meilisearch/src/routes/metrics.rs @@ -1,4 +1,3 @@ -use actix_web::http::header; use actix_web::web::{self, Data}; use actix_web::HttpResponse; use index_scheduler::{IndexScheduler, Query}; @@ -181,5 +180,12 @@ pub async fn get_metrics( let response = String::from_utf8(buffer).expect("Failed to convert bytes to string"); - Ok(HttpResponse::Ok().insert_header(header::ContentType(mime::TEXT_PLAIN)).body(response)) + // We cannot specify the version with ContentType(TEXT_PLAIN_UTF_8) so we have to write everything by hand :( + // see the following for what should be returned: https://prometheus.io/docs/instrumenting/content_negotiation/#content-type-response + let content_type = ("content-type", "text/plain; version=0.0.4; charset=utf-8"); + + Ok(HttpResponse::Ok() + // .insert_header(header::ContentType(mime::TEXT_PLAIN_UTF_8)) + .insert_header(content_type) + .body(response)) }