From: Josef 'Jeff' Sipek Date: Wed, 12 Jun 2019 08:36:12 +0000 (+0300) Subject: stats: event export - Introduce a per exporter block transport timeout setting X-Git-Tag: 2.3.9~451 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51d3b0d47f963fca4e65eba521c726b1c3c2a5ed;p=thirdparty%2Fdovecot%2Fcore.git stats: event export - Introduce a per exporter block transport timeout setting This commit adds a new per event_exporter { } block setting to specify the transport timeout. For example: event_exporter { transport = foo transport_args = ... transport_timeout = 123msecs format = bar format_args = ... } Note that this commit only introduces the setting. The transports will be changed to make use of it in future commits. --- diff --git a/src/stats/stats-metrics.c b/src/stats/stats-metrics.c index 9da52a7da9..aa063b44f8 100644 --- a/src/stats/stats-metrics.c +++ b/src/stats/stats-metrics.c @@ -57,6 +57,7 @@ static void stats_exporters_add_set(struct stats_metrics *metrics, exporter = p_new(metrics->pool, struct exporter, 1); exporter->name = p_strdup(metrics->pool, set->name); exporter->transport_args = p_strdup(metrics->pool, set->transport_args); + exporter->transport_timeout = set->transport_timeout; exporter->time_format = set->parsed_time_format; /* TODO: The following should be plugable. diff --git a/src/stats/stats-metrics.h b/src/stats/stats-metrics.h index 05ba321de7..231048a0e2 100644 --- a/src/stats/stats-metrics.h +++ b/src/stats/stats-metrics.h @@ -27,6 +27,7 @@ struct exporter { * the "how do we get the event to the external location" knobs */ const char *transport_args; + unsigned int transport_timeout; /* function to send the event */ void (*transport)(const struct exporter *, const buffer_t *); diff --git a/src/stats/stats-settings.c b/src/stats/stats-settings.c index ef269f760a..98eb899e52 100644 --- a/src/stats/stats-settings.c +++ b/src/stats/stats-settings.c @@ -62,6 +62,7 @@ static const struct setting_define stats_exporter_setting_defines[] = { DEF(SET_STR, name), DEF(SET_STR, transport), DEF(SET_STR, transport_args), + DEF(SET_TIME_MSECS, transport_timeout), DEF(SET_STR, format), DEF(SET_STR, format_args), SETTING_DEFINE_LIST_END @@ -71,6 +72,7 @@ static const struct stats_exporter_settings stats_exporter_default_settings = { .name = "", .transport = "", .transport_args = "", + .transport_timeout = 250, /* ms */ .format = "", .format_args = "", }; diff --git a/src/stats/stats-settings.h b/src/stats/stats-settings.h index 565771543d..64ff7b83cd 100644 --- a/src/stats/stats-settings.h +++ b/src/stats/stats-settings.h @@ -61,6 +61,7 @@ struct stats_exporter_settings { const char *name; const char *transport; const char *transport_args; + unsigned int transport_timeout; const char *format; const char *format_args;