Change in libosmocore[master]: statsd: fix rendering for groups with idx==0

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Earwin @ Fairwaves gerrit-no-reply at lists.osmocom.org
Sat May 9 21:41:49 UTC 2020


Earwin @ Fairwaves has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/18173 )


Change subject: statsd: fix rendering for groups with idx==0
......................................................................

statsd: fix rendering for groups with idx==0

while skipping `0` might be visually pleasant for non-repeating groups, e.g.:
    bsc.assignment.completed

it makes metrics parsing very awkward for repeating groups, e.g.:
    bts.chreq.total
    bts.1.chreq.total
    bts.2.chreq.total

and since nobody's going to look at raw statsd stream anyway,
we can live with some extra zeroes

Change-Id: Id294202fbcebe0b6b155c7f267b2da73af20adf4
---
M src/stats_statsd.c
1 file changed, 6 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/18173/1

diff --git a/src/stats_statsd.c b/src/stats_statsd.c
index c3f739e..d449667 100644
--- a/src/stats_statsd.c
+++ b/src/stats_statsd.c
@@ -99,24 +99,16 @@
 	int old_len = msgb_length(srep->buffer);
 
 	if (prefix) {
-		if (name1) {
-			if (index1 != 0)
-				fmt = "%1$s.%2$s.%6$u.%3$s:%4$d|%5$s";
-			else
-				fmt = "%1$s.%2$s.%3$s:%4$d|%5$s";
-		} else {
+		if (name1)
+			fmt = "%1$s.%2$s.%6$u.%3$s:%4$d|%5$s";
+		else
 			fmt = "%1$s.%2$0.0s%3$s:%4$d|%5$s";
-		}
 	} else {
 		prefix = "";
-		if (name1) {
-			if (index1 != 0)
-				fmt = "%1$s%2$s.%6$u.%3$s:%4$d|%5$s";
-			else
-				fmt = "%1$s%2$s.%3$s:%4$d|%5$s";
-		} else {
+		if (name1)
+			fmt = "%1$s%2$s.%6$u.%3$s:%4$d|%5$s";
+		else
 			fmt = "%1$s%2$0.0s%3$s:%4$d|%5$s";
-		}
 	}
 
 	if (srep->agg_enabled) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id294202fbcebe0b6b155c7f267b2da73af20adf4
Gerrit-Change-Number: 18173
Gerrit-PatchSet: 1
Gerrit-Owner: Earwin @ Fairwaves <earwin at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200509/70004290/attachment.htm>


More information about the gerrit-log mailing list