[sr-dev] git:master:21f29a8a: tmx: Fix relayed_replies counter
Stefan Mititelu
stefan.mititelu at 1and1.ro
Fri Nov 27 12:43:50 CET 2015
Module: kamailio
Branch: master
Commit: 21f29a8a9cce5fba7defd89368794d1631adb702
URL: https://github.com/kamailio/kamailio/commit/21f29a8a9cce5fba7defd89368794d1631adb702
Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Date: 2015-11-27T11:36:16+02:00
tmx: Fix relayed_replies counter
In the current implementation, for simple call timeout scenarios,
we get 2 x local_replies(100 + 408) and have only 1 x completed
6xx/5xx/4xx/3xx/2xx(408). The relayed_replies were computed by substracting
completed - local_replies(1 - 2), resulting in the max ulong.
Fix the above by counting the relayed_total(which include also the 1xx)
and substracting the relayed_local.
---
Modified: modules/tm/t_reply.c
Modified: modules/tm/t_stats.c
Modified: modules/tm/t_stats.h
Modified: modules/tmx/tmx_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/21f29a8a9cce5fba7defd89368794d1631adb702.diff
Patch: https://github.com/kamailio/kamailio/commit/21f29a8a9cce5fba7defd89368794d1631adb702.patch
---
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 0041a4f..f4e4dcd 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -555,6 +555,7 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
update_reply_stats( code );
trans->relayed_reply_branch=-2;
t_stats_replied_locally();
+ t_stats_replied_total();
if (lock) UNLOCK_REPLIES( trans );
/* do UAC cleanup procedures in case we generated
@@ -1866,6 +1867,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
}
}
update_reply_stats( relayed_code );
+ t_stats_replied_total();
if (!buf) {
LOG(L_ERR, "ERROR: relay_reply: "
"no mem for outbound reply buffer\n");
@@ -1890,7 +1892,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
update_local_tags(t, &bm, uas_rb->buffer, buf);
t_stats_replied_locally();
}
-
+
/* update the status ... */
t->uas.status = relayed_code;
t->relayed_reply_branch = relay;
@@ -2047,6 +2049,7 @@ enum rps local_reply( struct cell *t, struct sip_msg *p_msg, int branch,
}
t->uas.status = winning_code;
update_reply_stats( winning_code );
+ t_stats_replied_total();
if (unlikely(is_invite(t) && winning_msg!=FAKED_REPLY &&
winning_code>=200 && winning_code <300 &&
has_tran_tmcbs(t, TMCB_LOCAL_COMPLETED) )) {
diff --git a/modules/tm/t_stats.c b/modules/tm/t_stats.c
index f0c3ba0..8187568 100644
--- a/modules/tm/t_stats.c
+++ b/modules/tm/t_stats.c
@@ -94,6 +94,7 @@ void free_tm_stats()
(res)->completed_6xx=(s1)->completed_6xx+(s2)->completed_6xx; \
(res)->completed_2xx=(s1)->completed_2xx+(s2)->completed_2xx; \
(res)->replied_locally=(s1)->replied_locally+(s2)->replied_locally; \
+ (res)->replied_total=(s1)->replied_total+(s2)->replied_total; \
(res)->deleted=(s1)->deleted+(s2)->deleted; \
}while(0)
diff --git a/modules/tm/t_stats.h b/modules/tm/t_stats.h
index 2cbeeb7..dcb0be7 100644
--- a/modules/tm/t_stats.h
+++ b/modules/tm/t_stats.h
@@ -44,6 +44,7 @@ struct t_proc_stats {
stat_counter completed_3xx, completed_4xx, completed_5xx,
completed_6xx, completed_2xx;
stat_counter replied_locally;
+ stat_counter replied_total;
stat_counter deleted;
#ifdef TM_MORE_STATS
/* number of created transactions */
@@ -126,6 +127,11 @@ inline void static t_stats_replied_locally(void)
tm_stats[process_no].s.replied_locally++;
}
+inline void static t_stats_replied_total(void)
+{
+ tm_stats[process_no].s.replied_total++;
+}
+
int init_tm_stats(void);
diff --git a/modules/tmx/tmx_mod.c b/modules/tmx/tmx_mod.c
index d2d8e60..10e509d 100644
--- a/modules/tmx/tmx_mod.c
+++ b/modules/tmx/tmx_mod.c
@@ -820,12 +820,7 @@ unsigned long tmx_stats_rcv_rpls(void)
unsigned long tmx_stats_rld_rpls(void)
{
tmx_stats_update();
- return _tmx_stats_all.completed_6xx
- + _tmx_stats_all.completed_5xx
- + _tmx_stats_all.completed_4xx
- + _tmx_stats_all.completed_3xx
- + _tmx_stats_all.completed_2xx
- - _tmx_stats_all.replied_locally;
+ return _tmx_stats_all.replied_total - _tmx_stats_all.replied_locally;
}
unsigned long tmx_stats_loc_rpls(void)
More information about the sr-dev
mailing list