mirror of https://gerrit.osmocom.org/libosmocore
stats_statsd: Send all stat_items as gauges
When sending a statsd metric we need to specify a type which can be a "g"auge, "c"ounter, "t"imer, "h"istogram, and "m"eter. We used to just pass the stat_item unit into this field, but that is the unit of the metric (Seconds for a timer, % for utilization, ...). Change the type field so stat_items are sent as "g"auges. Note that negative values don't seem to be supported by statsd. Change-Id: Ia16270d36c9a14521594de4b99a48c83e4ac07d4
This commit is contained in:
parent
7a2ec6e118
commit
0c878fd4f5
|
@ -184,20 +184,17 @@ static int osmo_stats_reporter_statsd_send_item(struct osmo_stats_reporter *srep
|
|||
const struct osmo_stat_item_group *statg,
|
||||
const struct osmo_stat_item_desc *desc, int64_t value)
|
||||
{
|
||||
const char *unit = desc->unit;
|
||||
|
||||
if (unit == OSMO_STAT_ITEM_NO_UNIT) {
|
||||
unit = "g";
|
||||
if (value < 0)
|
||||
osmo_stats_reporter_statsd_send(srep,
|
||||
statg->desc->group_name_prefix,
|
||||
statg->idx,
|
||||
desc->name, 0, unit);
|
||||
}
|
||||
if (value < 0) {
|
||||
return osmo_stats_reporter_statsd_send(srep,
|
||||
statg->desc->group_name_prefix,
|
||||
statg->idx,
|
||||
desc->name, value, unit);
|
||||
desc->name, 0, "g");
|
||||
} else {
|
||||
return osmo_stats_reporter_statsd_send(srep,
|
||||
statg->desc->group_name_prefix,
|
||||
statg->idx,
|
||||
desc->name, value, "g");
|
||||
}
|
||||
}
|
||||
#endif /* !EMBEDDED */
|
||||
|
||||
|
|
Loading…
Reference in New Issue