summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d474703)
raw | patch | inline | side by side (parent: d474703)
author | Florian Forster <octo@collectd.org> | |
Thu, 11 Jul 2013 08:11:14 +0000 (10:11 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 11 Jul 2013 08:11:14 +0000 (10:11 +0200) |
The prefix is added in statsd_metric_lookup_unsafe(), so we don't need
to do this here anymore. Since snprintf() is expensive, this increases
performance considerably.
to do this here anymore. Since snprintf() is expensive, this increases
performance considerably.
src/statsd.c | patch | blob | history |
diff --git a/src/statsd.c b/src/statsd.c
index 46575845e31be5b911c7e191d36ec7061cb0f02c..2ba42bfdd121f029eeb18c1af10e073d3006d11f 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
char const *value_str,
char const *extra)
{
- char key[DATA_MAX_NAME_LEN + 2];
value_t value;
value_t scale;
int status;
if (value.derive < 1)
return (-1);
- ssnprintf (key, sizeof (key), "c:%s", name);
-
- return (statsd_metric_add (key,
+ return (statsd_metric_add (name,
(int64_t) (((gauge_t) value.derive) / scale.gauge),
STATSD_COUNTER));
} /* }}} int statsd_handle_counter */
static int statsd_handle_gauge (char const *name, /* {{{ */
char const *value_str)
{
- char key[DATA_MAX_NAME_LEN + 2];
value_t value;
int status;
if (status != 0)
return (status);
- ssnprintf (key, sizeof (key), "g:%s", name);
-
if ((value_str[0] == '+') || (value_str[0] == '-'))
- return (statsd_metric_add (key, (int64_t) value.derive, STATSD_GAUGE));
+ return (statsd_metric_add (name, (int64_t) value.derive, STATSD_GAUGE));
else
- return (statsd_metric_set (key, (int64_t) value.derive, STATSD_GAUGE));
+ return (statsd_metric_set (name, (int64_t) value.derive, STATSD_GAUGE));
} /* }}} int statsd_handle_gauge */
static int statsd_handle_timer (char const *name, /* {{{ */