laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/27137 )
Change subject: stats: use tcp stat names as provided ......................................................................
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 --- M src/stats_tcp.c 1 file changed, 1 insertion(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/stats_tcp.c b/src/stats_tcp.c index dec5b5d..ebb380e 100644 --- a/src/stats_tcp.c +++ b/src/stats_tcp.c @@ -119,8 +119,7 @@
/* 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);