Merge remote-tracking branch 'github/pr/1915'
authorFlorian Forster <octo@collectd.org>
Mon, 12 Sep 2016 18:22:35 +0000 (20:22 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 12 Sep 2016 18:22:35 +0000 (20:22 +0200)
1  2 
src/collectd.conf.pod
src/write_graphite.c

diff --combined src/collectd.conf.pod
@@@ -7818,28 -7818,14 +7818,34 @@@ If set to B<true>, append the name of t
  identifier. If set to B<false> (the default), this is only done when there is
  more than one DS.
  
+ =item B<DropDuplicateFields> B<false>|B<true>
+ If set to B<true>, detect and remove duplicate components in Graphite metric
+ names. For example, the metric name  C<host.load.load.shortterm> will
+ be shortened to C<host.load.shortterm>.
  =back
  
 +=head2 Plugin C<write_log>
 +
 +The C<write_log> plugin writes metrics as INFO log messages.
 +
 +This plugin supports two output formats: I<Graphite> and I<JSON>.
 +
 +Synopsis:
 +
 + <Plugin write_log>
 +   Format Graphite
 + </Plugin>
 +
 +=over 4
 +
 +=item B<Format> I<Format>
 +
 +The output format to use. Can be one of C<Graphite> or C<JSON>.
 +
 +=back
 +
  =head2 Plugin C<write_tsdb>
  
  The C<write_tsdb> plugin writes data to I<OpenTSDB>, a scalable open-source
@@@ -9401,10 -9387,6 +9407,10 @@@ Available options
  
  =item B<TypeInstance> I<Regex> I<Replacement>
  
 +=item B<MetaData> I<String> I<Regex> I<Replacement>
 +
 +=item B<DeleteMetaData> I<String> I<Regex>
 +
  Match the appropriate field with the given regular expression I<Regex>. If the
  regular expression matches, that part that matches is replaced with
  I<Replacement>. If multiple places of the input buffer match a given regular
diff --combined src/write_graphite.c
@@@ -548,6 -548,9 +548,9 @@@ static int wg_config_node (oconfig_item
          else if (strcasecmp ("AlwaysAppendDS", child->key) == 0)
              cf_util_get_flag (child, &cb->format_flags,
                      GRAPHITE_ALWAYS_APPEND_DS);
+         else if (strcasecmp ("DropDuplicateFields", child->key) == 0)
+             cf_util_get_flag (child, &cb->format_flags,
+                     GRAPHITE_DROP_DUPE_FIELDS);
          else if (strcasecmp ("EscapeCharacter", child->key) == 0)
              config_set_char (&cb->escape_char, child);
          else
          ssnprintf (callback_name, sizeof (callback_name), "write_graphite/%s",
                  cb->name);
  
 -    user_data_t ud = {
 -        .data = cb,
 -        .free_func = wg_callback_free
 -    };
 -
 -    plugin_register_write (callback_name, wg_write, &ud);
 +    plugin_register_write (callback_name, wg_write,
 +            &(user_data_t) {
 +                .data = cb,
 +                .free_func = wg_callback_free,
 +            });
  
 -    ud.free_func = NULL;
 -    plugin_register_flush (callback_name, wg_flush, &ud);
 +    plugin_register_flush (callback_name, wg_flush, &(user_data_t) { .data = cb });
  
      return (0);
  }