summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b750eb)
raw | patch | inline | side by side (parent: 1b750eb)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Fri, 26 Jul 2013 13:24:37 +0000 (15:24 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 14 Aug 2013 14:33:37 +0000 (16:33 +0200) |
src/statsd.c | patch | blob | history | |
src/utils_latency.c | patch | blob | history | |
src/utils_latency.h | patch | blob | history |
diff --git a/src/statsd.c b/src/statsd.c
index 1045aeaa8474ee78605f7878c9abe40b220f64b1..731a6e8c4e8548e37c3f8798c536580a5d63e145 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
static _Bool conf_timer_lower = 0;
static _Bool conf_timer_upper = 0;
+static _Bool conf_timer_sum = 0;
/* Must hold metrics_lock when calling this function. */
static statsd_metric_t *statsd_metric_lookup_unsafe (char const *name, /* {{{ */
cf_util_get_boolean (child, &conf_timer_lower);
else if (strcasecmp ("TimerUpper", child->key) == 0)
cf_util_get_boolean (child, &conf_timer_upper);
+ else if (strcasecmp ("TimerSum", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_sum);
else if (strcasecmp ("TimerPercentile", child->key) == 0)
statsd_config_timer_percentile (child);
else
plugin_dispatch_values (&vl);
}
+ if (conf_timer_sum) {
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
+ "%s-sum", name);
+ values[0].gauge = CDTIME_T_TO_DOUBLE (
+ latency_counter_get_sum (metric->latency));
+ plugin_dispatch_values (&vl);
+ }
+
for (i = 0; i < conf_timer_percentile_num; i++)
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
diff --git a/src/utils_latency.c b/src/utils_latency.c
index 01c8b5c22ea6c9a5f5952a9a5248e055562cc800..4a250c33a4143730f1609da50af3ac428855c79a 100644 (file)
--- a/src/utils_latency.c
+++ b/src/utils_latency.c
return (lc->max);
} /* }}} cdtime_t latency_counter_get_max */
+cdtime_t latency_counter_get_sum (latency_counter_t *lc) /* {{{ */
+{
+ if (lc == NULL)
+ return (0);
+ return (lc->sum);
+} /* }}} cdtime_t latency_counter_get_sum */
+
cdtime_t latency_counter_get_average (latency_counter_t *lc) /* {{{ */
{
double average;
diff --git a/src/utils_latency.h b/src/utils_latency.h
index 3da23082be6c68291f8c69994a0fc401a2b6c8f9..352a4ec3a4fedf42798d130c54c2e6fcbec894cf 100644 (file)
--- a/src/utils_latency.h
+++ b/src/utils_latency.h
cdtime_t latency_counter_get_min (latency_counter_t *lc);
cdtime_t latency_counter_get_max (latency_counter_t *lc);
+cdtime_t latency_counter_get_sum (latency_counter_t *lc);
cdtime_t latency_counter_get_average (latency_counter_t *lc);
cdtime_t latency_counter_get_percentile (latency_counter_t *lc,
double percent);