Add compression and histogram metric type for Prometheus (#987)

Fixes #932
Also fixes #966

Decided not to add Summary type because it has the same functionality as Histogram but makes more calculations on client side (Clio side). See https://prometheus.io/docs/practices/histograms for detailed comparison.
This commit is contained in:
Sergey Kuznetsov
2023-11-22 12:55:06 +00:00
committed by GitHub
parent 8ebe2d6a80
commit b998473673
41 changed files with 2230 additions and 619 deletions

View File

@@ -54,8 +54,14 @@ handlePrometheusRequest(http::request<http::string_body> const& req, bool const
}
auto response = http::response<http::string_body>(http::status::ok, req.version());
response.set(http::field::content_type, "text/plain; version=0.0.4");
response.body() = PrometheusService::collectMetrics(); // TODO(#932): add gzip compression
response.body() = PrometheusService::collectMetrics();
if (PrometheusService::compressReplyEnabled())
response.set(http::field::content_encoding, "gzip");
return response;
}