From: Martin Michaelis Date: Tue, 16 Feb 2021 20:06:50 +0000 (+0100) Subject: stats: openmentrics: Change histogram bucket unit to seconds X-Git-Tag: 2.3.14~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=939c30da5f724e7b2d2d0263bf74323ca7431c2d;p=thirdparty%2Fdovecot%2Fcore.git stats: openmentrics: Change histogram bucket unit to seconds In ae678116a79fff609cdf4fb1eb7eb3db2975bf1c the unit of durations was changed from microseconds to seconds, but the `le` field in histograms is still in microseconds. --- diff --git a/src/stats/stats-service-openmetrics.c b/src/stats/stats-service-openmetrics.c index 56c35dd022..83832a3160 100644 --- a/src/stats/stats-service-openmetrics.c +++ b/src/stats/stats-service-openmetrics.c @@ -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); }