From 3935366d86737a13a584d7bcf87c70c797ebe9f7 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 23 Sep 2024 00:14:04 +0200 Subject: [PATCH] End Prometheus stats with a new line separator (#826) End prometheus stats with a new line separator According to the [OpenMetrics specification](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#overall-structure), each line MUST end with `\n`. Previously, the last line was not ending with `\n`, so that strict parsers had issues reading the Prometheus stats. --- src/prometheus.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/prometheus.rs b/src/prometheus.rs index 93348b8..6c9a1be 100644 --- a/src/prometheus.rs +++ b/src/prometheus.rs @@ -309,6 +309,7 @@ async fn prometheus_stats( push_pool_stats(&mut lines); push_server_stats(&mut lines); push_database_stats(&mut lines); + lines.push("".to_string()); // Ensure to end the stats with a line terminator as required by the specification. Response::builder() .header("content-type", "text/plain; version=0.0.4")