aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-03-26 10:42:09 +0100
committerlaforge <laforge@osmocom.org>2021-04-07 18:38:54 +0000
commit2623fca8ad6f1617c407d270e9be4acc96499c2b (patch)
treedcfb9c2898bcb8961c4815f53f84ed17742217f1
parentc7930589fd5ebfbb591c39b6f3bc220ade95a877 (diff)
stats: log error when missing stats values (v2)
-rw-r--r--src/stat_item.c4
-rw-r--r--tests/stats/stats_test.c2
-rw-r--r--tests/stats/stats_test.err4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/stat_item.c b/src/stat_item.c
index 2d964445..40374a7c 100644
--- a/src/stat_item.c
+++ b/src/stat_item.c
@@ -261,6 +261,10 @@ int osmo_stat_item_get_next(const struct osmo_stat_item *item, int32_t *next_id,
*next_id = item_value->id + 1;
+ if (id_delta > 1) {
+ LOGP(DLSTATS, LOGL_ERROR, "%s: %d stats values skipped\n", item->desc->name, id_delta - 1);
+ }
+
return id_delta;
}
diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c
index 1d53aaa3..a4aedd38 100644
--- a/tests/stats/stats_test.c
+++ b/tests/stats/stats_test.c
@@ -195,6 +195,7 @@ static void stat_test(void)
osmo_stat_item_set(statg->items[TEST_B_ITEM], 1000 + i);
}
+ fprintf(stderr, "Skipping %d values\n", 93 - 65);
rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &next_id_a, &value);
OSMO_ASSERT(rc == 93 - 65 + 1);
OSMO_ASSERT(value == 93);
@@ -205,6 +206,7 @@ static void stat_test(void)
OSMO_ASSERT(value == i);
}
+ fprintf(stderr, "Skipping %d values\n", 90 - 65);
rc = osmo_stat_item_get_next(statg->items[TEST_B_ITEM], &next_id_b, &value);
OSMO_ASSERT(rc == 90 - 65 + 1);
OSMO_ASSERT(value == 1000 + 90);
diff --git a/tests/stats/stats_test.err b/tests/stats/stats_test.err
index 3accf545..69104d9c 100644
--- a/tests/stats/stats_test.err
+++ b/tests/stats/stats_test.err
@@ -1,3 +1,7 @@
+Skipping 28 values
+DLSTATS ERROR item.a: 28 stats values skipped
+Skipping 25 values
+DLSTATS ERROR item.b: 25 stats values skipped
Start test: test_reporting
DLGLOBAL ERROR counter group 'ctr-test:one' already exists for index 2, instead using index 3. This is a software bug that needs fixing.
DLGLOBAL ERROR 'ctr-test.one_dot' is not a valid counter group identifier