74 static const char app[] =
"StatsD";
88 double numerical_value = strtod(value,
NULL);
90 if (numerical_value < pow(-2, 63) || numerical_value > pow(2, 63)) {
110 double numerical_value = strtod(value,
NULL);
112 if (numerical_value < 0 || numerical_value > pow(2, 64)) {
133 const char *valid_metrics[] = {
"g",
"s",
"ms",
"c"};
141 for (i = 0; i <
ARRAY_LEN(valid_metrics); i++) {
142 if (!strcmp(valid_metrics[i], metric)) {
165 int decimal_counter = 0;
169 if (!isdigit(*num++)) {
170 if (strstr(numeric_value,
".") !=
NULL && decimal_counter == 0) {
195 const char *actual_value;
197 if ((raw_value[0] ==
'+') || (raw_value[0] ==
'-')) {
198 actual_value = &raw_value[1];
201 " operator.\n", raw_value);
205 actual_value = &raw_value[0];
227 " character.\n", name);
338 if (strstr(value,
"|") !=
NULL) {
340 " in a set metric.\n", value);
350 double numerical_rate = 1.0;
361 "StatsD(metric_type,statistic_name,value[,sample_rate]). Sample rate is the " 362 "only optional parameter.\n");
373 if (!strcmp(
args.metric_type,
"g")) {
379 else if (!strcmp(
args.metric_type,
"c")) {
385 else if (!strcmp(
args.metric_type,
"ms")) {
391 else if (!strcmp(
args.metric_type,
"s")) {
398 if (
args.sample_rate) {
404 numerical_rate = strtod(
args.sample_rate,
NULL);
427 .requires =
"res_statsd",
static int validate_metric_type_gauge(const char *statistic_name, const char *value)
Calls the appropriate functions to validate a gauge metric.
Main Channel structure associated with a channel.
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.
Asterisk main include file. File version handling, generic pbx functions.
String manipulation functions.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static int validate_name(const char *name)
Check to ensure the statistic name is valid.
static int non_neg_value_range(const char *value)
Check to ensure the value is within the allowed range.
static int validate_metric_type_set(const char *statistic_name, const char *value)
Calls the appropriate functions to validate a set metric.
int ast_unregister_application(const char *app)
Unregister an application.
void ast_statsd_log_string(const char *metric_name, const char *metric_type, const char *value, double sample_rate)
Send a stat to the configured statsd server.
#define ast_strlen_zero(foo)
static int validate_metric_type_timer(const char *statistic_name, const char *value)
Calls the appropriate functions to validate a timer metric.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Core PBX routines and definitions.
static int validate_numeric(const char *numeric_value)
Check to ensure that a numeric value is valid.
static int determine_actual_value(const char *raw_value)
Determines the actual value of a number by looking for a leading + or -.
static int statsd_exec(struct ast_channel *chan, const char *data)
Support for logging to various files, console and syslog Configuration in file logger.conf.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static int value_in_range(const char *value)
Check to ensure the value is within the allowed range.
static int unload_module(void)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
static int load_module(void)
#define AST_APP_ARG(name)
Define an application argument.