]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: refactor duration field name into a macro
authorSiavash Tavakoli <siavash.tavakoli@open-xchange.com>
Thu, 18 Feb 2021 21:39:09 +0000 (21:39 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 19 Feb 2021 13:29:49 +0000 (13:29 +0000)
src/stats/stats-metrics.c
src/stats/stats-metrics.h

index ea5083deb0d65a952c7332108d9090da48203d42..3dc8b7717de5badd6e46253e0630de1df20b9459 100644 (file)
@@ -504,7 +504,7 @@ static void
 stats_metric_event(struct metric *metric, struct event *event, pool_t pool)
 {
        /* duration is special - we always add it */
-       stats_metric_event_field(event, "duration",
+       stats_metric_event_field(event, STATS_EVENT_FIELD_NAME_DURATION,
                                 metric->duration_stats);
 
        for (unsigned int i = 0; i < metric->fields_count; i++)
@@ -550,7 +550,7 @@ void stats_metrics_event(struct stats_metrics *metrics, struct event *event,
           below.  This is necessary to allow group-by functions to quantize
           based on the event duration. */
        event_get_last_duration(event, &duration);
-       event_add_int(event, "duration", duration);
+       event_add_int(event, STATS_EVENT_FIELD_NAME_DURATION, duration);
 
        /* process stats */
        iter = event_filter_match_iter_init(metrics->stats_filter, event, ctx);
index 1328da1133043057982ed7bcefa3d55a10d3c564..587b4b4f7e1d8084129a4ff0048af730f83db59e 100644 (file)
@@ -4,6 +4,8 @@
 #include "stats-settings.h"
 #include "sha1.h"
 
+#define STATS_EVENT_FIELD_NAME_DURATION "duration"
+
 struct metric;
 
 struct exporter {