| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
#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 -. | |
| static int | load_module (void) | 
| static int | non_neg_value_range (const char *value) | 
| Check to ensure the value is within the allowed range. | |
| 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. | |
| static int | validate_metric_type_counter (const char *statistic_name, const char *value) | 
| Calls the appropriate functions to validate a counter metric. | |
| static int | validate_metric_type_gauge (const char *statistic_name, const char *value) | 
| Calls the appropriate functions to validate a gauge metric. | |
| static int | validate_metric_type_set (const char *statistic_name, const char *value) | 
| Calls the appropriate functions to validate a set metric. | |
| static int | validate_metric_type_timer (const char *statistic_name, const char *value) | 
| Calls the appropriate functions to validate a timer metric. | |
| static int | validate_name (const char *name) | 
| Check to ensure the statistic name is valid. | |
| static int | validate_numeric (const char *numeric_value) | 
| Check to ensure that a numeric value is valid. | |
| static int | value_in_range (const char *value) | 
| Check to ensure the value is within the allowed range. | |
| Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "StatsD Dialplan Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .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 432 of file app_statsd.c.
| 
 | static | 
Definition at line 432 of file app_statsd.c.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 432 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 198 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 422 of file app_statsd.c.
References app, ast_register_application_xml, and statsd_exec().
| 
 | 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 dailplan application is within the allowed range of [0, 2^64] as specified by StatsD.
| zero | on success. | 
| 1 | on error. | 
Definition at line 113 of file app_statsd.c.
References ast_log, AST_LOG_WARNING, NULL, and value.
Referenced by validate_metric_type_timer().
| 
 | static | 
Definition at line 351 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 417 of file app_statsd.c.
References app, and ast_unregister_application().
| 
 | 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 135 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 278 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero(), determine_actual_value(), validate_name(), value, 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 251 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero(), determine_actual_value(), validate_name(), value, 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 332 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero(), NULL, validate_name(), and value.
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 305 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero(), non_neg_value_range(), validate_name(), validate_numeric(), and value.
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 227 of file app_statsd.c.
References ast_log, AST_LOG_ERROR, ast_strlen_zero(), name, 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 167 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 dailplan application is within the allowed range of [-2^63, 2^63] as specified by StatsD.
| zero | on success. | 
| 1 | on error. | 
Definition at line 91 of file app_statsd.c.
References ast_log, AST_LOG_WARNING, NULL, and value.
Referenced by validate_metric_type_counter(), and validate_metric_type_gauge().
| 
 | static | 
Definition at line 432 of file app_statsd.c.
| 
 | static | 
Definition at line 78 of file app_statsd.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 432 of file app_statsd.c.