Change in libosmocore[master]: stats: log error when missing stats values

osmith gerrit-no-reply at lists.osmocom.org
Wed Mar 17 18:00:44 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/23390 )

Change subject: stats: log error when missing stats values
......................................................................

stats: log error when missing stats values

Let the user know when the stats were not consumed fast enough for the
given FIFO length.

Related: SYS#4877
Change-Id: If0e8ab55103007693101538fb6ea310075217774
---
M src/stat_item.c
M tests/stats/stats_test.c
M tests/stats/stats_test.err
3 files changed, 156 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/stat_item.c b/src/stat_item.c
index ba36464..a44b3ad 100644
--- a/src/stat_item.c
+++ b/src/stat_item.c
@@ -60,6 +60,7 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/timer.h>
 #include <osmocom/core/stat_item.h>
+#include <osmocom/core/logging.h>
 
 /*! global list of stat_item groups */
 static LLIST_HEAD(osmo_stat_item_groups);
@@ -242,6 +243,10 @@
 
 	idx_delta = item_value->id + 1 - *next_idx;
 
+	if (idx_delta > 1) {
+		LOGP(DLSTATS, LOGL_ERROR, "%s: %d stats values skipped\n", item->desc->name, idx_delta - 1);
+	}
+
 	*next_idx = item_value->id + 1;
 
 	return idx_delta;
diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c
index 707f606..b81ad6b 100644
--- a/tests/stats/stats_test.c
+++ b/tests/stats/stats_test.c
@@ -120,6 +120,7 @@
 	value = osmo_stat_item_get_last(statg->items[TEST_A_ITEM]);
 	OSMO_ASSERT(value == -1);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc == 0\n");
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc == 0);
 
@@ -128,13 +129,16 @@
 	value = osmo_stat_item_get_last(statg->items[TEST_A_ITEM]);
 	OSMO_ASSERT(value == 1);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc > 0\n");
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc > 0);
 	OSMO_ASSERT(value == 1);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc == 0\n");
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc == 0);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc > 0\n");
 	for (i = 2; i <= 32; i++) {
 		osmo_stat_item_set(statg->items[TEST_A_ITEM], i);
 		osmo_stat_item_set(statg->items[TEST_B_ITEM], 1000 + i);
@@ -220,17 +224,20 @@
 	rc = osmo_stat_item_discard(statg->items[TEST_A_ITEM], &rd_a);
 	OSMO_ASSERT(rc > 0);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc == 0\n");
 	rc = osmo_stat_item_discard(statg->items[TEST_A_ITEM], &rd_a);
 	OSMO_ASSERT(rc == 0);
 
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc == 0);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc > 0\n");
 	osmo_stat_item_set(statg->items[TEST_A_ITEM], 98);
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc > 0);
 	OSMO_ASSERT(value == 98);
 
+	fprintf(stderr, "osmo_stat_item_get_next rc == 0\n");
 	rc = osmo_stat_item_get_next(statg->items[TEST_A_ITEM], &rd_a, &value);
 	OSMO_ASSERT(rc == 0);
 
diff --git a/tests/stats/stats_test.err b/tests/stats/stats_test.err
index 3accf54..d059ffd 100644
--- a/tests/stats/stats_test.err
+++ b/tests/stats/stats_test.err
@@ -1,3 +1,147 @@
+osmo_stat_item_get_next rc == 0
+osmo_stat_item_get_next rc > 0
+DLSTATS ERROR item.a: 1 stats values skipped
+osmo_stat_item_get_next rc == 0
+osmo_stat_item_get_next rc > 0
+DLSTATS ERROR item.b: 3 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 4 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.a: 57 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.a: 1 stats values skipped
+DLSTATS ERROR item.b: 51 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+DLSTATS ERROR item.b: 1 stats values skipped
+osmo_stat_item_get_next rc == 0
+osmo_stat_item_get_next rc > 0
+osmo_stat_item_get_next rc == 0
 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

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23390
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If0e8ab55103007693101538fb6ea310075217774
Gerrit-Change-Number: 23390
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210317/943ee975/attachment.htm>


More information about the gerrit-log mailing list