From e53ab7ffa52682fa59882ebaeb4489315d3c3832 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Wed, 4 Jul 2018 20:09:26 +0700 Subject: [PATCH] write_kafka: Added Graphite tag support --- src/collectd.conf.pod | 23 +++++++++++++++++++++-- src/write_kafka.c | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index e4a5945b..35c80209 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -9821,17 +9821,26 @@ been set to B. =item B (B=I only) A prefix can be added in the metric name when outputting in the I -format. It's added before the I name. +format. + +When B is I, prefix is added before the I name. Metric name will be CprefixEEhostEEpostfixEEpluginEEtypeEEnameE> +When B is I, prefix is added in front of series name. + =item B (B=I only) A postfix can be added in the metric name when outputting in the I -format. It's added after the I name. +format. + +When B is I, postfix is added after the I name. Metric name will be CprefixEEhostEEpostfixEEpluginEEtypeEEnameE> +When B is I, prefix value appended to the end of series +name (before the first ; that separates the name from the tags). + =item B (B=I only) Specify a character to replace dots (.) in the host part of the metric name. @@ -9846,6 +9855,8 @@ path component, for example C. If set to B (the default), the plugin and plugin instance (and likewise the type and type instance) are put into one component, for example C. +Option value is not used when B is I. + =item B B|B If set to B, append the name of the I (DS) to the "metric" @@ -9858,6 +9869,14 @@ If set to B (the default) the C<.> (dot) character is replaced with I. Otherwise, if set to B, the C<.> (dot) character is preserved, i.e. passed through. +Option value is not used when B is I. + +=item B B|B + +If set to B Graphite metric names will be generated as tagged series. + +Default value: B. + =item B B|B If set to B (the default), convert counter values to rates. If set to diff --git a/src/write_kafka.c b/src/write_kafka.c index c120d15d..04e67b92 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -383,6 +383,10 @@ static void kafka_config_topic(rd_kafka_conf_t *conf, status = cf_util_get_flag(child, &tctx->graphite_flags, GRAPHITE_PRESERVE_SEPARATOR); + } else if (strcasecmp("GraphiteUseTags", child->key) == 0) { + status = + cf_util_get_flag(child, &tctx->graphite_flags, GRAPHITE_USE_TAGS); + } else if (strcasecmp("GraphitePrefix", child->key) == 0) { status = cf_util_get_string(child, &tctx->prefix); } else if (strcasecmp("GraphitePostfix", child->key) == 0) { -- 2.11.0