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),
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;
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);