From 01e8c91df517fbf27d769a07630ac8177cf0328d Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 9 Nov 2015 14:13:23 +0100 Subject: 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 --- src/stats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stats.c b/src/stats.c index d83fd87d..16e2971d 100644 --- a/src/stats.c +++ b/src/stats.c @@ -665,7 +665,6 @@ static int osmo_stat_item_handler( 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 @@ static void flush_all_reporters() 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; -- cgit v1.2.3