Skip to content

Commit 27f0be5

Browse files
authored
Merge pull request #1122 from rust-lang/prom-content-type
2 parents 5cefccc + 0ceefbb commit 27f0be5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ui/src/server_axum.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ async fn meta_gist_get(
641641
.context(GistLoadingSnafu)
642642
}
643643

644-
async fn metrics(_: MetricsAuthorization) -> Result<Vec<u8>, StatusCode> {
644+
async fn metrics(_: MetricsAuthorization) -> Result<impl IntoResponse, StatusCode> {
645645
use prometheus::{Encoder, TextEncoder};
646646

647647
let metric_families = prometheus::gather();
@@ -650,7 +650,15 @@ async fn metrics(_: MetricsAuthorization) -> Result<Vec<u8>, StatusCode> {
650650

651651
encoder
652652
.encode(&metric_families, &mut buffer)
653-
.map(|_| buffer)
653+
.map(|_| {
654+
(
655+
[(
656+
header::CONTENT_TYPE,
657+
"text/plain; version=0.0.4; charset=utf-8",
658+
)],
659+
buffer,
660+
)
661+
})
654662
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
655663
}
656664

0 commit comments

Comments
 (0)