return (-1);
}
- if (strncasecmp ("Gauge", ci->values[0].value.string, strlen ("Gauge")) == 0)
+ char const *ds_type = ci->values[0].value.string;
+ if (strncasecmp ("Gauge", ds_type, strlen ("Gauge")) == 0)
{
cm->flags = UTILS_MATCH_DS_TYPE_GAUGE;
- if (strcasecmp ("GaugeAverage", ci->values[0].value.string) == 0)
+ if (strcasecmp ("GaugeAverage", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_AVERAGE;
- else if (strcasecmp ("GaugeMin", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("GaugeMin", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_MIN;
- else if (strcasecmp ("GaugeMax", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("GaugeMax", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_MAX;
- else if (strcasecmp ("GaugeLast", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("GaugeLast", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_LAST;
- else if (strcasecmp ("GaugeInc", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("GaugeInc", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_INC;
- else if (strcasecmp ("GaugeAdd", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("GaugeAdd", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_ADD;
else if (strcasecmp ("GaugePersist", ci->values[0].value.string) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_PERSIST;
else
cm->flags = 0;
}
- else if (strcasecmp ("Latency", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("Distribution", ds_type) == 0)
{
cm->flags = UTILS_MATCH_DS_TYPE_GAUGE | UTILS_MATCH_CF_GAUGE_LATENCY;
+
+ int status = latency_config (&cm->latency, ci, "tail");
+ if (status != 0)
+ return (status);
}
- else if (strncasecmp ("Counter", ci->values[0].value.string, strlen ("Counter")) == 0)
+ else if (strncasecmp ("Counter", ds_type, strlen ("Counter")) == 0)
{
cm->flags = UTILS_MATCH_DS_TYPE_COUNTER;
- if (strcasecmp ("CounterSet", ci->values[0].value.string) == 0)
+ if (strcasecmp ("CounterSet", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_COUNTER_SET;
- else if (strcasecmp ("CounterAdd", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("CounterAdd", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_COUNTER_ADD;
- else if (strcasecmp ("CounterInc", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("CounterInc", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_COUNTER_INC;
else
cm->flags = 0;
}
- else if (strncasecmp ("Derive", ci->values[0].value.string, strlen ("Derive")) == 0)
+ else if (strncasecmp ("Derive", ds_type, strlen ("Derive")) == 0)
{
cm->flags = UTILS_MATCH_DS_TYPE_DERIVE;
- if (strcasecmp ("DeriveSet", ci->values[0].value.string) == 0)
+ if (strcasecmp ("DeriveSet", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_DERIVE_SET;
- else if (strcasecmp ("DeriveAdd", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("DeriveAdd", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_DERIVE_ADD;
- else if (strcasecmp ("DeriveInc", ci->values[0].value.string) == 0)
+ else if (strcasecmp ("DeriveInc", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_DERIVE_INC;
else
cm->flags = 0;
}
- else if (strncasecmp ("Absolute", ci->values[0].value.string, strlen ("Absolute")) == 0)
+ else if (strncasecmp ("Absolute", ds_type, strlen ("Absolute")) == 0)
{
cm->flags = UTILS_MATCH_DS_TYPE_ABSOLUTE;
- if (strcasecmp ("AbsoluteSet", ci->values[0].value.string) == 0)
+ if (strcasecmp ("AbsoluteSet", ds_type) == 0)
cm->flags |= UTILS_MATCH_CF_ABSOLUTE_SET;
else
cm->flags = 0;
status = cf_util_get_string (option, &cm.type);
else if (strcasecmp ("Instance", option->key) == 0)
status = cf_util_get_string (option, &cm.type_instance);
- else if (strncasecmp ("Latency", option->key, strlen ("Latency")) == 0)
- {
- if (strcasecmp ("LatencyPercentile", option->key) == 0)
- status = latency_config_add_percentile ("tail", &cm.latency, option);
- else if (strcasecmp ("LatencyPercentileType", option->key) == 0)
- status = cf_util_get_string (option, &cm.latency.percentile_type);
- else if (strcasecmp ("LatencyRate", option->key) == 0)
- status = latency_config_add_rate ("tail", &cm.latency, option);
- else if (strcasecmp ("LatencyRateType", option->key) == 0)
- status = cf_util_get_string (option, &cm.latency.rates_type);
- else if (strcasecmp ("LatencyLower", option->key) == 0)
- status = cf_util_get_boolean (option, &cm.latency.lower);
- else if (strcasecmp ("LatencyUpper", option->key) == 0)
- status = cf_util_get_boolean (option, &cm.latency.upper);
- else if (strcasecmp ("LatencyAvg", option->key) == 0)
- status = cf_util_get_boolean (option, &cm.latency.avg);
- else
- {
- WARNING ("tail plugin: Option `%s' not allowed here.", option->key);
- status = -1;
- }
- }
else
{
WARNING ("tail plugin: Option `%s' not allowed here.", option->key);
break;
}
- if ((cm.flags & UTILS_MATCH_DS_TYPE_GAUGE)
- && (cm.flags & UTILS_MATCH_CF_GAUGE_LATENCY))
- {
-
- if (cm.type_instance != NULL)
- {
- WARNING ("tail plugin: `DSType Latency' and `Instance %s' in `Match' "
- "block could not be used together.", cm.type_instance);
- status = -1;
- break;
- }
-
- if (cm.latency.percentile_num == 0 && cm.latency.rates_num == 0)
- {
- WARNING ("tail plugin: `Match' with `DSType Latency' has no "
- "`LatencyPercentile' or `LatencyRate' options.");
- status = -1;
- break;
- }
- }
-
break;
} /* while (status == 0) */
if (status == 0)
{
+ // TODO(octo): there's nothing "simple" about the latency stuff …
status = tail_match_add_match_simple (tm, cm.regex, cm.excluderegex,
cm.flags, "tail", plugin_instance, cm.type, cm.type_instance,
cm.latency, interval);
if (status != 0)
- {
ERROR ("tail plugin: tail_match_add_match_simple failed.");
- }
}
sfree (cm.regex);