From f2be0f34b9940d2baa6d0612c5941d864ee86e4d Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sun, 2 Jul 2017 10:40:23 +0100 Subject: [PATCH] Use histogram, not summary, in WAI https://prometheus.io/docs/practices/histograms/ has a full discussion, but the gist is that histograms can be aggregated across processes whereas summaries cannot. This makes histograms more useful in environments where there is more than one process handling web requests, which is perhaps the more common case. --- .../src/Network/Wai/Middleware/Prometheus.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wai-middleware-prometheus/src/Network/Wai/Middleware/Prometheus.hs b/wai-middleware-prometheus/src/Network/Wai/Middleware/Prometheus.hs index ce6203e..5fb0e36 100644 --- a/wai-middleware-prometheus/src/Network/Wai/Middleware/Prometheus.hs +++ b/wai-middleware-prometheus/src/Network/Wai/Middleware/Prometheus.hs @@ -49,9 +49,9 @@ instance Default.Default PrometheusSettings where {-# NOINLINE requestLatency #-} -- XXX: https://prometheus.io/docs/practices/naming/ says this should be -- _seconds, not _microseconds. -requestLatency :: Prom.Metric (Prom.Vector Prom.Label3 Prom.Summary) +requestLatency :: Prom.Metric (Prom.Vector Prom.Label3 Prom.Histogram) requestLatency = Prom.unsafeRegisterIO $ Prom.vector ("handler", "method", "status_code") - $ Prom.summary info Prom.defaultQuantiles + $ Prom.histogram info Prom.defaultBuckets where info = Prom.Info "http_request_duration_seconds" "The HTTP request latencies in seconds."