From: ~/.gitconfig Date: Thu, 14 Aug 2014 13:50:24 +0000 (+0300) Subject: refactor prefix feature - cast directly to service_buffer X-Git-Tag: collectd-5.5.0~219^2~8 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e13fe5ecd3ca0a487f1af33c10f92bc37bb17aa3;p=collectd.git refactor prefix feature - cast directly to service_buffer --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 5780722e..bdc4969c 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -1238,6 +1238,7 @@ # StoreRates true # AlwaysAppendDS false # TTLFactor 2.0 +# Prefix ServicePrefix # # Tag "foobar" # Attribute "foo" "bar" diff --git a/src/write_riemann.c b/src/write_riemann.c index 56752124..1ce6bfb4 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -431,7 +431,7 @@ static Msg *riemann_notification_to_protobuf (struct riemann_host *host, /* {{{ riemann_event_add_tag (event, riemann_tags[i]); format_name (service_buffer, sizeof (service_buffer), - /* host = */ host->prefix, n->plugin, n->plugin_instance, + /* host = */ "", n->plugin, n->plugin_instance, n->type, n->type_instance); event->service = strdup (&service_buffer[1]); @@ -567,14 +567,14 @@ static Event *riemann_value_to_protobuf (struct riemann_host const *host, /* {{{ } format_name (name_buffer, sizeof (name_buffer), - /* host = */ host->prefix, vl->plugin, vl->plugin_instance, + /* host = */ "", vl->plugin, vl->plugin_instance, vl->type, vl->type_instance); if (host->always_append_ds || (ds->ds_num > 1)) - ssnprintf (service_buffer, sizeof (service_buffer), - "%s/%s", &name_buffer[1], ds->ds[index].name); + ssnprintf (service_buffer, sizeof (service_buffer), + "%s/%s/%s", host->prefix, &name_buffer[1], ds->ds[index].name); else - sstrncpy (service_buffer, &name_buffer[1], - sizeof (service_buffer)); + ssnprintf (service_buffer, sizeof (service_buffer), + "%s/%s", host->prefix, &name_buffer[1]); event->service = strdup (service_buffer);