]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: openmentrics: Change histogram bucket unit to seconds
authorMartin Michaelis <code@mgjm.de>
Tue, 16 Feb 2021 20:06:50 +0000 (21:06 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 19 Feb 2021 13:29:49 +0000 (13:29 +0000)
In ae678116a79fff609cdf4fb1eb7eb3db2975bf1c the unit of durations was changed
from microseconds to seconds, but the `le` field in histograms is still in
microseconds.

src/stats/stats-service-openmetrics.c

index 56c35dd022e2e9114b533dfc4b33fd853b4af17b..83832a3160b1b0db29a93b421e74848e36eb6797 100644 (file)
@@ -198,8 +198,10 @@ openmetrics_export_histogram_bucket(struct openmetrics_request *req,
        }
        if (bucket_limit == INTMAX_MAX)
                str_append(out, "le=\"+Inf\"");
-       else
-               str_printfa(out, "le=\"%jd\"", bucket_limit);
+       else {
+               /* Convert from microseconds to seconds */
+               str_printfa(out, "le=\"%.6f\"", bucket_limit/1e6F);
+       }
        str_printfa(out, "} %"PRIu64"\n", count);
 }