From 0a8741b9061f8df4a78a448c021612db06e17425 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 26 Nov 2016 19:00:19 +0100 Subject: [PATCH] amqp, write_graphite and write_kafka plugins: Implement the "[Graphite]PreserveSeparator" option. Fixes: #419 --- src/amqp.c | 3 +++ src/collectd.conf.in | 1 + src/collectd.conf.pod | 24 ++++++++++++++++++++++++ src/write_graphite.c | 3 +++ src/write_kafka.c | 4 ++++ 5 files changed, 35 insertions(+) diff --git a/src/amqp.c b/src/amqp.c index 4089fc32..b237ba3d 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -1015,6 +1015,9 @@ static int camqp_config_connection (oconfig_item_t *ci, /* {{{ */ else if ((strcasecmp ("GraphiteAlwaysAppendDS", child->key) == 0) && publish) status = cf_util_get_flag (child, &conf->graphite_flags, GRAPHITE_ALWAYS_APPEND_DS); + else if ((strcasecmp ("GraphitePreserveSeparator", child->key) == 0) && publish) + status = cf_util_get_flag (child, &conf->graphite_flags, + GRAPHITE_PRESERVE_SEPARATOR); else if ((strcasecmp ("GraphitePrefix", child->key) == 0) && publish) status = cf_util_get_string (child, &conf->prefix); else if ((strcasecmp ("GraphitePostfix", child->key) == 0) && publish) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 8ad24d60..719010f4 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -1439,6 +1439,7 @@ # AlwaysAppendDS false # EscapeCharacter "_" # SeparateInstances false +# PreserveSeparator false # DropDuplicateFields false # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index dcf6c36d..4293abf3 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -555,6 +555,7 @@ B # GraphiteEscapeChar "_" # GraphiteSeparateInstances false # GraphiteAlwaysAppendDS false + # GraphitePreserveSeparator false # Receive values from an AMQP broker @@ -729,6 +730,12 @@ If set to B, append the name of the I (DS) to the "metric" identifier. If set to B (the default), this is only done when there is more than one DS. +=item B B|B + +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. + =back =head2 Plugin C @@ -8014,6 +8021,12 @@ If set to B, append the name of the I (DS) to the "metric" identifier. If set to B (the default), this is only done when there is more than one DS. +=item B B|B + +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. + =item B B|B If set to B, detect and remove duplicate components in Graphite metric @@ -8416,6 +8429,17 @@ 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. +=item B B|B + +If set to B, append the name of the I (DS) to the "metric" +identifier. If set to B (the default), this is only done when there is +more than one DS. + +=item B B|B + +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. =item B B|B If set to B (the default), convert counter values to rates. If set to diff --git a/src/write_graphite.c b/src/write_graphite.c index ad8dfcef..9feb6b33 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -566,6 +566,9 @@ static int wg_config_node (oconfig_item_t *ci) else if (strcasecmp ("AlwaysAppendDS", child->key) == 0) cf_util_get_flag (child, &cb->format_flags, GRAPHITE_ALWAYS_APPEND_DS); + else if (strcasecmp ("PreserveSeparator", child->key) == 0) + cf_util_get_flag (child, &cb->format_flags, + GRAPHITE_PRESERVE_SEPARATOR); else if (strcasecmp ("DropDuplicateFields", child->key) == 0) cf_util_get_flag (child, &cb->format_flags, GRAPHITE_DROP_DUPE_FIELDS); diff --git a/src/write_kafka.c b/src/write_kafka.c index 6018fea0..a719cd37 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -376,6 +376,10 @@ static void kafka_config_topic(rd_kafka_conf_t *conf, oconfig_item_t *ci) /* {{{ status = cf_util_get_flag (child, &tctx->graphite_flags, GRAPHITE_ALWAYS_APPEND_DS); + } else if (strcasecmp ("GraphitePreserveSeparator", child->key) == 0) { + status = cf_util_get_flag (child, &tctx->graphite_flags, + GRAPHITE_PRESERVE_SEPARATOR); + } else if (strcasecmp ("GraphitePrefix", child->key) == 0) { status = cf_util_get_string (child, &tctx->prefix); } else if (strcasecmp ("GraphitePostfix", child->key) == 0) { -- 2.30.2