From 0ceefbbee43f3444433fa85245f93db27dbcc30a Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Thu, 21 Nov 2024 22:15:33 -0500 Subject: [PATCH] Use the correct content type for metrics --- ui/src/server_axum.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/src/server_axum.rs b/ui/src/server_axum.rs index 0be65f19..3e8c214a 100644 --- a/ui/src/server_axum.rs +++ b/ui/src/server_axum.rs @@ -641,7 +641,7 @@ async fn meta_gist_get( .context(GistLoadingSnafu) } -async fn metrics(_: MetricsAuthorization) -> Result, StatusCode> { +async fn metrics(_: MetricsAuthorization) -> Result { use prometheus::{Encoder, TextEncoder}; let metric_families = prometheus::gather(); @@ -650,7 +650,15 @@ async fn metrics(_: MetricsAuthorization) -> Result, StatusCode> { encoder .encode(&metric_families, &mut buffer) - .map(|_| buffer) + .map(|_| { + ( + [( + header::CONTENT_TYPE, + "text/plain; version=0.0.4; charset=utf-8", + )], + buffer, + ) + }) .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR) }