From a6d1ef0d6048cf59cdd154a3452681ad65141859 Mon Sep 17 00:00:00 2001 From: Michael Iedema Date: Thu, 10 Feb 2022 09:30:26 -0800 Subject: [PATCH] stats: use tcp stat names as provided If an API user has defined a name for this particular stat, we should consider it unique and not append ip and port information from the connection. By appending ip and port information to all tcp stat names, we end up creating unique stat names every time a reconnection occurs and the source port changes. This makes the statistic impossible to track over time as it is continually using a different name. A quick example from the field over the course of a day: tcp.ipa-rsl-0,r=192.168.55.88.33056<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.33311<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.35510<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.35958<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.36110<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.39269<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.40394<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.40397<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.42920<->l=192.168.0.1.3003.tcp.rtt tcp.ipa-rsl-0,r=192.168.55.88.43839<->l=192.168.0.1.3003.tcp.rtt This change would treat tcp stats like other stats around the system. A unique name must be set by the API user. This would let us set a unique name like the following to avoid the situation above: bts.0.rsl.0.tcp.rtt Matching the existing rsl related stats: bts.0.rsl.delete_ind bts.0.rsl.ipa_nack bts.0.rsl.unknown ...they retain a constant name regardless of the underlying connectivity situation. Change-Id: Ib04c2f5bfcbd6c19dd87debf1fc053abf0b9bef2 --- src/stats_tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stats_tcp.c b/src/stats_tcp.c index dec5b5d04..ebb380e87 100644 --- a/src/stats_tcp.c +++ b/src/stats_tcp.c @@ -119,8 +119,7 @@ static void fill_stats(struct stats_tcp_entry *stats_tcp_entry) /* Update statistics */ if (stats_tcp_entry->name) - snprintf(stat_name, sizeof(stat_name), "%s,%s", stats_tcp_entry->name, - osmo_sock_get_name2(stats_tcp_entry->fd->fd)); + snprintf(stat_name, sizeof(stat_name), "%s", stats_tcp_entry->name); else snprintf(stat_name, sizeof(stat_name), "%s", osmo_sock_get_name2(stats_tcp_entry->fd->fd)); osmo_stat_item_group_set_name(stats_tcp_entry->stats_tcp, stat_name);