Skip to content

Commit

Permalink
End Prometheus stats with a new line separator (#826)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MrSerth authored Sep 22, 2024
1 parent b575935 commit 3935366
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 3935366

Please sign in to comment.