Change in osmo-bsc[master]: add stat items bsc.0.num_msc:connected, .num_msc:total

neels gerrit-no-reply at lists.osmocom.org
Mon Aug 30 16:44:31 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/25226 )

Change subject: add stat items bsc.0.num_msc:connected, .num_msc:total
......................................................................

add stat items bsc.0.num_msc:connected, .num_msc:total

We already have MSC connection stat items, but for hysterical raisins
there are separate such stats for each MSC. Hence we have N connection
counters, each being either 0 or 1, for a single MSC.

Add a new stat counting the *overall* MSCs that are connected,
and one indicating the total number of configured MSCs.

Related: SYS#5542
Related: I178dcf4516606aa561d47b06061b8a416d3c40cf (osmo-ttcn3-hacks)
Change-Id: If76bbf9b3adb64c68d5c31c6b526fa71a99996ae
---
M include/osmocom/bsc/bsc_stats.h
M src/osmo-bsc/a_reset.c
M src/osmo-bsc/bsc_stats.c
3 files changed, 8 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h
index 8fcd5a0..639f87f 100644
--- a/include/osmocom/bsc/bsc_stats.h
+++ b/include/osmocom/bsc/bsc_stats.h
@@ -88,6 +88,8 @@
 /* OsmoBSC stat_item indexes */
 enum {
 	BSC_STAT_NUM_BTS_TOTAL,
+	BSC_STAT_NUM_MSC_CONNECTED,
+	BSC_STAT_NUM_MSC_TOTAL,
 };
 
 /* BTS counter index if a BTS could not be found
diff --git a/src/osmo-bsc/a_reset.c b/src/osmo-bsc/a_reset.c
index 0befd72..d23ffa7 100644
--- a/src/osmo-bsc/a_reset.c
+++ b/src/osmo-bsc/a_reset.c
@@ -25,6 +25,7 @@
 #include <osmocom/bsc/bsc_msc_data.h>
 #include <osmocom/bsc/osmo_bsc_sigtran.h>
 #include <osmocom/bsc/bssmap_reset.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 static void a_reset_tx_reset(void *data)
 {
@@ -43,6 +44,7 @@
 	struct bsc_msc_data *msc = data;
 	LOGP(DMSC, LOGL_NOTICE, "(msc%d) BSSMAP assocation is up\n", msc->nr);
 	osmo_stat_item_inc(osmo_stat_item_group_get_item(msc->msc_statg, MSC_STAT_MSC_LINKS_ACTIVE), 1);
+	osmo_stat_item_inc(osmo_stat_item_group_get_item(msc->network->bsc_statg, BSC_STAT_NUM_MSC_CONNECTED), 1);
 	osmo_signal_dispatch(SS_MSC, S_MSC_CONNECTED, msc);
 }
 
@@ -51,6 +53,7 @@
 	struct bsc_msc_data *msc = data;
 	LOGP(DMSC, LOGL_NOTICE, "(msc%d) BSSMAP assocation is down\n", msc->nr);
 	osmo_stat_item_dec(osmo_stat_item_group_get_item(msc->msc_statg, MSC_STAT_MSC_LINKS_ACTIVE), 1);
+	osmo_stat_item_dec(osmo_stat_item_group_get_item(msc->network->bsc_statg, BSC_STAT_NUM_MSC_CONNECTED), 1);
 	osmo_signal_dispatch(SS_MSC, S_MSC_LOST, msc);
 	osmo_bsc_sigtran_reset(msc);
 }
@@ -76,6 +79,7 @@
 	}
 
 	msc->a.bssmap_reset = bssmap_reset_alloc(msc, name, &cfg);
+	osmo_stat_item_inc(osmo_stat_item_group_get_item(msc->network->bsc_statg, BSC_STAT_NUM_MSC_TOTAL), 1);
 }
 
 /* Confirm that we successfully received a reset acknowledge message */
diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c
index 8fc4c38..36d38c2 100644
--- a/src/osmo-bsc/bsc_stats.c
+++ b/src/osmo-bsc/bsc_stats.c
@@ -111,6 +111,8 @@
 
 static const struct osmo_stat_item_desc bsc_stat_desc[] = {
 	[BSC_STAT_NUM_BTS_TOTAL] = { "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 },
+	[BSC_STAT_NUM_MSC_CONNECTED] = { "num_msc:connected", "Number of actively connected MSCs", "", 16, 0 },
+	[BSC_STAT_NUM_MSC_TOTAL] = { "num_msc:total", "Number of configured MSCs, not necessarily connected", "", 1, 0 },
 };
 
 const struct osmo_stat_item_group_desc bsc_statg_desc = {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If76bbf9b3adb64c68d5c31c6b526fa71a99996ae
Gerrit-Change-Number: 25226
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr 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/20210830/26d8d130/attachment.htm>


More information about the gerrit-log mailing list