Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <math.h>
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
#include "asterisk/strings.h"
#include "asterisk/statsd.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | determine_actual_value (const char *raw_value) |
Determines the actual value of a number by looking for a leading + or -. More... | |
static int | load_module (void) |
static int | non_neg_value_range (const char *value) |
Check to ensure the value is within the allowed range. More... | |
static int | statsd_exec (struct ast_channel *chan, const char *data) |
static int | unload_module (void) |
static int | validate_metric (const char *metric) |
Check to ensure the metric type is a valid metric type. More... | |
static int | validate_metric_type_counter (const char *statistic_name, const char *value) |
Calls the appropriate functions to validate a counter metric. More... | |
static int | validate_metric_type_gauge (const char *statistic_name, const char *value) |
Calls the appropriate functions to validate a gauge metric. More... | |
static int | validate_metric_type_set (const char *statistic_name, const char *value) |
Calls the appropriate functions to validate a set metric. More... | |
static int | validate_metric_type_timer (const char *statistic_name, const char *value) |
Calls the appropriate functions to validate a timer metric. More... | |
static int | validate_name (const char *name) |
Check to ensure the statistic name is valid. More... | |
static int | validate_numeric (const char *numeric_value) |
Check to ensure that a numeric value is valid. More... | |
static int | value_in_range (const char *value) |
Check to ensure the value is within the allowed range. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "StatsD Dialplan Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .requires = "res_statsd", } |
static const char | app [] = "StatsD" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static |
Definition at line 428 of file app_statsd.c.
|
static |
Definition at line 428 of file app_statsd.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 428 of file app_statsd.c.
|
static |
Determines the actual value of a number by looking for a leading + or -.
raw_value | The entire numeric string to be sent to StatsD. |
This function checks to see if the numeric string contains valid characters and then isolates the actual number to be sent for validation. Returns the result of the numeric validation.
zero | on success. |
1 | on error. |
Definition at line 194 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, and validate_numeric().
Referenced by validate_metric_type_counter(), and validate_metric_type_gauge().
|
static |
Definition at line 418 of file app_statsd.c.
References app, AST_MODFLAG_DEFAULT, AST_MODULE_INFO(), AST_MODULE_SUPPORT_EXTENDED, ast_register_application_xml, ASTERISK_GPL_KEY, statsd_exec(), and unload_module().
|
static |
Check to ensure the value is within the allowed range.
value | The value of the statistic to be sent to StatsD. |
This function checks to see if the value given to the StatsD daialplan application is within the allowed range of [0, 2^64] as specified by StatsD.
zero | on success. |
1 | on error. |
Definition at line 109 of file app_statsd.c.
References ast_log, AST_LOG_WARNING, and NULL.
Referenced by validate_metric_type_timer().
|
static |
Definition at line 347 of file app_statsd.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, AST_STANDARD_APP_ARGS, ast_statsd_log_string(), ast_strdupa, NULL, validate_metric(), validate_metric_type_counter(), validate_metric_type_gauge(), validate_metric_type_set(), validate_metric_type_timer(), validate_numeric(), and value.
Referenced by load_module().
|
static |
Definition at line 413 of file app_statsd.c.
References app, and ast_unregister_application().
Referenced by load_module().
|
static |
Check to ensure the metric type is a valid metric type.
metric | The metric type to be sent to StatsD. |
This function checks to see if the metric type given to the StatsD dialplan is a valid metric type. Metric types are determined by StatsD.
zero | on success. |
1 | on error. |
Definition at line 131 of file app_statsd.c.
References ARRAY_LEN, ast_log, AST_LOG_ERROR, and ast_strlen_zero.
Referenced by statsd_exec().
|
static |
Calls the appropriate functions to validate a counter metric.
statistic_name | The statistic name to be sent to StatsD. |
value | The value to be sent to StatsD. |
This function calls other validating functions to correctly validate each input based on allowable input for a counter metric.
zero | on success. |
1 | on error. |
Definition at line 274 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, determine_actual_value(), validate_name(), and value_in_range().
Referenced by statsd_exec().
|
static |
Calls the appropriate functions to validate a gauge metric.
statistic_name | The statistic name to be sent to StatsD. |
value | The value to be sent to StatsD. |
This function calls other validating functions to correctly validate each input based on allowable input for a gauge metric.
zero | on success. |
1 | on error. |
Definition at line 247 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, determine_actual_value(), validate_name(), and value_in_range().
Referenced by statsd_exec().
|
static |
Calls the appropriate functions to validate a set metric.
statistic_name | The statistic name to be sent to StatsD. |
value | The value to be sent to StatsD. |
This function calls other validating functions to correctly validate each input based on allowable input for a set metric.
zero | on success. |
1 | on error. |
Definition at line 328 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, NULL, and validate_name().
Referenced by statsd_exec().
|
static |
Calls the appropriate functions to validate a timer metric.
statistic_name | The statistic name to be sent to StatsD. |
value | The value to be sent to StatsD. |
This function calls other validating functions to correctly validate each input based on allowable input for a timer metric.
zero | on success. |
1 | on error. |
Definition at line 301 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, non_neg_value_range(), validate_name(), and validate_numeric().
Referenced by statsd_exec().
|
static |
Check to ensure the statistic name is valid.
name | The variable name to be sent to StatsD. |
This function checks to see if the statistic name given to the StatsD dialplan application is valid by ensuring that the name does not have any invalid characters.
zero | on success. |
1 | on error. |
Definition at line 223 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero, and NULL.
Referenced by validate_metric_type_counter(), validate_metric_type_gauge(), validate_metric_type_set(), and validate_metric_type_timer().
|
static |
Check to ensure that a numeric value is valid.
numeric_value | The numeric value to be sent to StatsD. |
This function checks to see if a number to be sent to StatsD is actually a valid number. One decimal is allowed.
zero | on success. |
1 | on error. |
Definition at line 163 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, and NULL.
Referenced by determine_actual_value(), statsd_exec(), and validate_metric_type_timer().
|
static |
Check to ensure the value is within the allowed range.
value | The value of the statistic to be sent to StatsD. |
This function checks to see if the value given to the StatsD daialplan application is within the allowed range of [-2^63, 2^63] as specified by StatsD.
zero | on success. |
1 | on error. |
Definition at line 87 of file app_statsd.c.
References ast_log, AST_LOG_WARNING, and NULL.
Referenced by validate_metric_type_counter(), and validate_metric_type_gauge().
|
static |
Definition at line 428 of file app_statsd.c.
|
static |
Definition at line 74 of file app_statsd.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 428 of file app_statsd.c.