Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/11439


Change subject: use a dynamic name for rtp connection rate counters
......................................................................

use a dynamic name for rtp connection rate counters

Before this change, when running 'show rate-counters' on the VTY,
rate counters groups for all RTP connections shared the same static
name "rtp connection statistics". This made it impossible to discern
which connection an RTP counter group applied to.

Instead, allocate a fresh copy of rate counter descriptions for each
RTP connection and use a connection-specific label for the rate counter
group which includes the internal connection ID, the endpoint number,
and the callid.

Example of the new rate counter group naming scheme:
"rtp statistics for connection 5E7B20AF, endpoint:0x2, callid '1226'"

With input from Philipp Maier.

Change-Id: I027644f4b913e1f966c11b081e9027e61591a224
Related: OS#2660
---
M src/libosmo-mgcp/mgcp_conn.c
1 file changed, 12 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/39/11439/1

diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 820c63a..dd3c64c 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -43,7 +43,7 @@

 const static struct rate_ctr_group_desc rate_ctr_group_desc = {
        .group_name_prefix = "conn_rtp",
-       .group_description = "rtp connection statistics",
+       .group_description = "rtp statistics",
        .class_id = 1,
        .num_ctr = ARRAY_SIZE(rate_ctr_desc),
        .ctr_desc = rate_ctr_desc
@@ -94,6 +94,8 @@
 static void mgcp_rtp_conn_init(struct mgcp_conn_rtp *conn_rtp, struct 
mgcp_conn *conn)
 {
        struct mgcp_rtp_end *end = &conn_rtp->end;
+       struct rate_ctr_group_desc *rate_ctrs;
+
        /* FIXME: Each new rate counter group requires an unique index. At the
         * moment we generate this index using this counter, but perhaps there
         * is a more concious way to assign the indexes. */
@@ -117,7 +119,15 @@
        end->output_enabled = 0;
        end->maximum_packet_time = -1;

-       conn_rtp->rate_ctr_group = rate_ctr_group_alloc(conn, 
&rate_ctr_group_desc, rate_ctr_index);
+       rate_ctrs = talloc(conn, struct rate_ctr_group_desc);
+       OSMO_ASSERT(rate_ctrs);
+       memcpy(rate_ctrs, &rate_ctr_group_desc, sizeof(*rate_ctrs));
+       rate_ctrs->group_description = talloc_asprintf(conn, "%s for connection 
%s, endpoint:0x%x, callid '%s'",
+                                                      
rate_ctr_group_desc.group_description, conn->id,
+                                                      
ENDPOINT_NUMBER(conn->endp), conn->endp->callid);
+       OSMO_ASSERT(rate_ctrs->group_description);
+       conn_rtp->rate_ctr_group = rate_ctr_group_alloc(conn, rate_ctrs, 
rate_ctr_index);
+       OSMO_ASSERT(conn_rtp->rate_ctr_group);
        conn_rtp->state.in_stream.err_ts_ctr = 
&conn_rtp->rate_ctr_group->ctr[IN_STREAM_ERR_TSTMP_CTR];
        conn_rtp->state.out_stream.err_ts_ctr = 
&conn_rtp->rate_ctr_group->ctr[OUT_STREAM_ERR_TSTMP_CTR];
        rate_ctr_index++;

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I027644f4b913e1f966c11b081e9027e61591a224
Gerrit-Change-Number: 11439
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de>

Reply via email to