From 59881fbb9988be2f4e07ca750f45a404e79cb115 Mon Sep 17 00:00:00 2001 From: "David M. Lee" Date: Tue, 24 Nov 2015 13:54:54 -0600 Subject: Fixed some typos Fixes some minor typos in the CHANGES file, plus an embarrasing typo in the StatsD API. Change-Id: I9ca4858c64a4a07d2643b81baa64baebb27a4eb7 --- CHANGES | 10 +++++----- include/asterisk/statsd.h | 9 +++++++-- res/res_endpoint_stats.c | 12 ++++++------ res/res_pjsip/location.c | 2 +- res/res_pjsip/pjsip_options.c | 6 +++--- res/res_pjsip_outbound_registration.c | 20 ++++++++++---------- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 6dd5efdb1..cd8a73643 100644 --- a/CHANGES +++ b/CHANGES @@ -44,9 +44,9 @@ res_pjsip_outbound_registration * If res_statsd is loaded and a StatsD server is configured, basic statistics regarding the state of outbound registrations will now be emitted. This includes: - - A GUAGE statistic for the overall number of outbound registrations, i.e.: + - A GAUGE statistic for the overall number of outbound registrations, i.e.: PJSIP.registrations.count - - A GUAGE statistic for the overall number of outbound registrations in a + - A GAUGE statistic for the overall number of outbound registrations in a particular state, e.g.: PJSIP.registrations.state.Registered @@ -57,7 +57,7 @@ res_pjsip * If res_statsd is loaded and a StatsD server is configured, basic statistics regarding the state of PJSIP contacts will not be emitted. This includes: - - A GUAGE statistic for the overall number of contacts in a particular + - A GAUGE statistic for the overall number of contacts in a particular state, e.g.: PJSIP.contacts.states.Reachable - A TIMER statistic for the RTT time for each qualified contact, e.g.: @@ -77,9 +77,9 @@ res_endpoint_stats ------------------- * A new module that emits StatsD statistics regarding Asterisk endpoints. This includes a total count of the number of endpoints, the count of the - number of endpoints in the technology agnosti state of the endpoint - + number of endpoints in the technology agnostic state of the endpoint - online or offline - as well as the number of channels associated with each - endpoint. These are recorded as three differeng GUAGE statistics: + endpoint. These are recorded as three different GAUGE statistics: - endpoints.count - endpoints.state.{unknown|offline|online} - endpoints.{tech}.{resource}.channels diff --git a/include/asterisk/statsd.h b/include/asterisk/statsd.h index c4ecce8f6..4cbd213ad 100644 --- a/include/asterisk/statsd.h +++ b/include/asterisk/statsd.h @@ -29,7 +29,12 @@ #include "asterisk/optional_api.h" /*! An instantaneous measurement of a value. */ -#define AST_STATSD_GUAGE "g" +#define AST_STATSD_GAUGE "g" +/*! + * Embarrassingly, gauge was misspelled for quite some time. + * \deprecated You should spell gauge correctly. + */ +#define AST_STATSD_GUAGE AST_STATSD_GAUGE /*! A change in a value. */ #define AST_STATSD_COUNTER "c" /*! Measure of milliseconds. */ @@ -71,7 +76,7 @@ AST_OPTIONAL_API(void, ast_statsd_log_string, (const char *metric_name, * * Example Usage: * \code - * ast_statsd_log_string_va(AST_STATSD_GUAGE, "+1", 1.0, "endpoints.states.%s", state_name); + * ast_statsd_log_string_va(AST_STATSD_GAUGE, "+1", 1.0, "endpoints.states.%s", state_name); * \endcode */ AST_OPTIONAL_API_ATTR(void, format(printf, 1, 5), ast_statsd_log_string_va, diff --git a/res/res_endpoint_stats.c b/res/res_endpoint_stats.c index 1e1123ea8..6b8479433 100644 --- a/res/res_endpoint_stats.c +++ b/res/res_endpoint_stats.c @@ -48,13 +48,13 @@ static void update_endpoint_state(struct ast_endpoint_snapshot *snapshot, const { switch (snapshot->state) { case AST_ENDPOINT_UNKNOWN: - ast_statsd_log_string("endpoints.state.unknown", AST_STATSD_GUAGE, delta, 1.0); + ast_statsd_log_string("endpoints.state.unknown", AST_STATSD_GAUGE, delta, 1.0); break; case AST_ENDPOINT_OFFLINE: - ast_statsd_log_string("endpoints.state.offline", AST_STATSD_GUAGE, delta, 1.0); + ast_statsd_log_string("endpoints.state.offline", AST_STATSD_GAUGE, delta, 1.0); break; case AST_ENDPOINT_ONLINE: - ast_statsd_log_string("endpoints.state.online", AST_STATSD_GUAGE, delta, 1.0); + ast_statsd_log_string("endpoints.state.online", AST_STATSD_GAUGE, delta, 1.0); break; } } @@ -62,17 +62,17 @@ static void update_endpoint_state(struct ast_endpoint_snapshot *snapshot, const static void handle_endpoint_update(struct ast_endpoint_snapshot *old_snapshot, struct ast_endpoint_snapshot *new_snapshot) { if (!old_snapshot && new_snapshot) { - ast_statsd_log_string("endpoints.count", AST_STATSD_GUAGE, "+1", 1.0); + ast_statsd_log_string("endpoints.count", AST_STATSD_GAUGE, "+1", 1.0); update_endpoint_state(new_snapshot, "+1"); } else if (old_snapshot && !new_snapshot) { - ast_statsd_log_string("endpoints.count", AST_STATSD_GUAGE, "-1", 1.0); + ast_statsd_log_string("endpoints.count", AST_STATSD_GAUGE, "-1", 1.0); update_endpoint_state(old_snapshot, "-1"); } else { if (old_snapshot->state != new_snapshot->state) { update_endpoint_state(old_snapshot, "-1"); update_endpoint_state(new_snapshot, "+1"); } - ast_statsd_log_full_va("endpoints.%s.%s.channels", AST_STATSD_GUAGE, new_snapshot->num_channels, 1.0, + ast_statsd_log_full_va("endpoints.%s.%s.channels", AST_STATSD_GAUGE, new_snapshot->num_channels, 1.0, new_snapshot->tech, new_snapshot->resource); } } diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 9cc7f1629..2e0d84b84 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -1015,7 +1015,7 @@ int ast_sip_initialize_sorcery_location(void) * object before PJSIP options handling is initialized. */ for (i = 0; i < REMOVED; i++) { - ast_statsd_log_full_va("PJSIP.contacts.states.%s", AST_STATSD_GUAGE, 0, 1.0, ast_sip_get_contact_status_label(i)); + ast_statsd_log_full_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE, 0, 1.0, ast_sip_get_contact_status_label(i)); } return 0; diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 58519a91f..b1724896d 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -114,7 +114,7 @@ struct ast_sip_contact_status *ast_res_pjsip_find_or_create_contact_status(const return NULL; } - ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GUAGE, + ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE, "+1", 1.0, ast_sip_get_contact_status_label(status->status)); return status; @@ -148,9 +148,9 @@ static void update_contact_status(const struct ast_sip_contact *contact, update->last_status = status->status; update->status = value; if (update->last_status != update->status) { - ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GUAGE, + ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE, "-1", 1.0, ast_sip_get_contact_status_label(update->last_status)); - ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GUAGE, + ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE, "+1", 1.0, ast_sip_get_contact_status_label(update->status)); } diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 6f3155d8b..4ba57481b 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -619,9 +619,9 @@ static void update_client_state_status(struct sip_outbound_registration_client_s return; } - ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GUAGE, "-1", 1.0, + ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GAUGE, "-1", 1.0, sip_outbound_registration_status_str(client_state->status)); - ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GUAGE, "+1", 1.0, + 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; } @@ -966,8 +966,8 @@ static void sip_outbound_registration_client_state_destroy(void *obj) { struct sip_outbound_registration_client_state *client_state = obj; - ast_statsd_log_string("PJSIP.registrations.count", AST_STATSD_GUAGE, "-1", 1.0); - ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GUAGE, "-1", 1.0, + ast_statsd_log_string("PJSIP.registrations.count", AST_STATSD_GAUGE, "-1", 1.0); + ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GAUGE, "-1", 1.0, sip_outbound_registration_status_str(client_state->status)); ast_taskprocessor_unreference(client_state->serializer); @@ -998,8 +998,8 @@ static struct sip_outbound_registration_state *sip_outbound_registration_state_a state->client_state->timer.user_data = state->client_state; state->client_state->timer.cb = sip_outbound_registration_timer_cb; - ast_statsd_log_string("PJSIP.registrations.count", AST_STATSD_GUAGE, "+1", 1.0); - ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GUAGE, "+1", 1.0, + ast_statsd_log_string("PJSIP.registrations.count", AST_STATSD_GAUGE, "+1", 1.0); + ast_statsd_log_string_va("PJSIP.registrations.state.%s", AST_STATSD_GAUGE, "+1", 1.0, sip_outbound_registration_status_str(state->client_state->status)); state->registration = ao2_bump(registration); @@ -2035,10 +2035,10 @@ static int load_module(void) ast_manager_register_xml("PJSIPShowRegistrationsOutbound", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_show_outbound_registrations); /* Clear any previous statsd gauges in case we weren't shutdown cleanly */ - ast_statsd_log("PJSIP.registrations.count", AST_STATSD_GUAGE, 0); - ast_statsd_log("PJSIP.registrations.state.Registered", AST_STATSD_GUAGE, 0); - ast_statsd_log("PJSIP.registrations.state.Unregistered", AST_STATSD_GUAGE, 0); - ast_statsd_log("PJSIP.registrations.state.Rejected", AST_STATSD_GUAGE, 0); + ast_statsd_log("PJSIP.registrations.count", AST_STATSD_GAUGE, 0); + ast_statsd_log("PJSIP.registrations.state.Registered", AST_STATSD_GAUGE, 0); + ast_statsd_log("PJSIP.registrations.state.Unregistered", AST_STATSD_GAUGE, 0); + ast_statsd_log("PJSIP.registrations.state.Rejected", AST_STATSD_GAUGE, 0); /* Load configuration objects */ ast_sorcery_load_object(ast_sip_get_sorcery(), "registration"); -- cgit v1.2.3