summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-12-05 22:00:23 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-12-05 22:00:23 -0600
commitd78ebce67ebab6e01376a8730cabf781a11a11b2 (patch)
treeac8d525705a3f8d4c336dba1a9f62df0df8de5e7
parent81dc839dab81840dc92fc421dd5f8a41867a1546 (diff)
parentd416dd7f65b131cb3c835764f62ded5da6b46204 (diff)
Merge "res_pjsip_outbound_registration.c: Filter redundant statsd reporting." into 14
-rw-r--r--CHANGES6
-rw-r--r--res/res_pjsip_outbound_registration.c21
2 files changed, 24 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index a74489f71..eec5f74e5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,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 */