diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-11-30 18:25:11 -0600 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-12-02 11:56:59 -0600 |
commit | 4b3d3fc7412817e76808d9ef5eff59c5713f41c5 (patch) | |
tree | 5350da021bfc5ee27d8721e1fdd12e6f8056343c | |
parent | cd5d9d1d693dd45900a34d88ec9c8b1dfa54bc31 (diff) |
res_pjsip_outbound_registration.c: Filter redundant statsd reporting.
Increasing the testsuite shutdown timeout before forcibly killing
Asterisk allowed more events to be sent out. Some tests failed as
a result. The tests/channels/pjsip/statsd/registrations failed
because we now get the statsd events that a comment in the test
configuration stated couldn't be intercepted. Unfortunately, we
get a variable number of events because of internal status state
transition races generating redundant statsd events.
We were reporting redundant statsd PJSIP.registrations.state changes
for internal state changes that equated to the same thing publicly.
* Made update_client_state_status() filter out redundant statsd
updates.
ASTERISK-26527
Change-Id: If851c7d514bb530d9226e4941ba97dcf52000646
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | res/res_pjsip_outbound_registration.c | 21 |
2 files changed, 24 insertions, 3 deletions
@@ -79,6 +79,12 @@ res_pjproject * Added new pjproject.conf startup section "log_level' option to set the initial maximum PJPROJECT logging level. +res_pjsip_outbound_registration +------------------ + * Statsd no longer logs redundant status PJSIP.registrations.state changes + for internal state transitions that don't change the reported public status + state. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 14.1.0 to Asterisk 14.2.0 ------------ ------------------------------------------------------------------------------ diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 29701a13c..d486ccd63 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -627,15 +627,30 @@ static void schedule_registration(struct sip_outbound_registration_client_state static void update_client_state_status(struct sip_outbound_registration_client_state *client_state, enum sip_outbound_registration_status status) { + const char *status_old; + const char *status_new; + if (client_state->status == status) { + /* Status state did not change at all. */ + return; + } + + status_old = sip_outbound_registration_status_str(client_state->status); + status_new = sip_outbound_registration_status_str(status); + client_state->status = status; + + if (!strcmp(status_old, status_new)) { + /* + * The internal status state may have changed but the status + * state we tell the world did not change at all. + */ return; } ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GAUGE, "-1", 1.0, - sip_outbound_registration_status_str(client_state->status)); + status_old); ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GAUGE, "+1", 1.0, - sip_outbound_registration_status_str(status)); - client_state->status = status; + status_new); } /*! \brief Callback function for unregistering (potentially) and destroying state */ |