summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-12-06 05:34:38 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-12-06 05:34:38 -0600
commitf08095ef1897da2d4e52f78a1d8878fec563edd8 (patch)
treef9384ccfcdfa88caee9427370525536b42f562e6 /res
parentb9a79a56c7fce7e95b1db6bfe0f3942ee63cdae4 (diff)
parent61ba2a014a25a8423f775b61b7ac56f951be3df8 (diff)
Merge "res_pjsip_outbound_registration.c: Filter redundant statsd reporting." into 13
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_outbound_registration.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index ff6619477..da15f19f5 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 */