X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fstatsd.c;h=7fe9eb3cb577ae8f246824cf1bb9971372cbac63;hb=dab48f284f9d4bb6ae98244310c5cdb6c5d91bf3;hp=5b0bdd693de71088f8ec47f3560b29c4c87f79f5;hpb=81a5fd5046c6a39f580a8fc1a3af837fd5f5aa5c;p=collectd.git diff --git a/src/statsd.c b/src/statsd.c index 5b0bdd69..7fe9eb3c 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -851,8 +851,19 @@ static int statsd_metric_submit_unsafe (char const *name, /* {{{ */ else values[0].gauge = (gauge_t) c_avl_size (metric->set); } - else - values[0].derive = (derive_t) metric->value; + else { /* STATSD_COUNTER */ + /* + * Expand a single value to two metrics: + * + * - The absolute counter, as a gauge + * - A derived rate for this counter + */ + values[0].derive = (derive_t) metric->value; + plugin_dispatch_values(&vl); + + sstrncpy(vl.type, "gauge", sizeof (vl.type)); + values[0].gauge = (gauge_t) metric->value; + } return (plugin_dispatch_values (&vl)); } /* }}} int statsd_metric_submit_unsafe */