]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: event export - Introduce a per exporter block transport timeout setting
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Wed, 12 Jun 2019 08:36:12 +0000 (11:36 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:01:37 +0000 (10:01 +0300)
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.

src/stats/stats-metrics.c
src/stats/stats-metrics.h
src/stats/stats-settings.c
src/stats/stats-settings.h

index 9da52a7da9f7567fa664a0f973d0c8465a08c238..aa063b44f8bb98b10dfac649b6d55eaec45eb96e 100644 (file)
@@ -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.
index 05ba321de7f363284bf3f443042e4d27d2533750..231048a0e2ee787ace1898b13ef8cccc4610d530 100644 (file)
@@ -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 *);
index f72527dda046a3ae5fdc1384b7dc00101eb042f1..57ee982686af6b15d58968ead66634fb17c31f12 100644 (file)
@@ -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 = "",
 };
index 565771543d0ae574ec89560f126436d4896bd55c..64ff7b83cde10883cbec5fd1c6d3b33a917cf065 100644 (file)
@@ -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;