stats: Fix not reported stat item values
Currently the global stat item index is being advanced in
osmo_stat_item_group_handler, so that the second and further groups
in the list will skip new item values.
This commit moves the call to osmo_stat_item_discard_all into
osmo_stats_report to a place where all groups have been processed
already.
Sponsored-by: On-Waves ehf
diff --git a/src/stats.c b/src/stats.c
index d83fd87..16e2971 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -665,7 +665,6 @@
static int osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
{
osmo_stat_item_for_each_item(statg, osmo_stat_item_handler, sctx_);
- osmo_stat_item_discard_all(¤t_stat_item_index);
return 0;
}
@@ -716,10 +715,13 @@
int osmo_stats_report()
{
+ /* per group actions */
osmo_counters_for_each(handle_counter, NULL);
rate_ctr_for_each_group(rate_ctr_group_handler, NULL);
osmo_stat_item_for_each_group(osmo_stat_item_group_handler, NULL);
+ /* global actions */
+ osmo_stat_item_discard_all(¤t_stat_item_index);
flush_all_reporters();
return 0;