78static const char app[] = 
"StatsD";
 
   92    double numerical_value = strtod(
value, 
NULL);
 
   94    if (numerical_value < pow(-2, 63) || numerical_value > pow(2, 63)) {
 
 
  114    double numerical_value = strtod(
value, 
NULL);
 
  116    if (numerical_value < 0 || numerical_value > pow(2, 64)) {
 
 
  137    const char *valid_metrics[] = {
"g",
"s",
"ms",
"c"};
 
  145    for (i = 0; i < 
ARRAY_LEN(valid_metrics); i++) {
 
  146        if (!strcmp(valid_metrics[i], metric)) {
 
 
  169    int decimal_counter = 0;
 
  173        if (!isdigit(*num++)) {
 
  174            if (strstr(numeric_value, 
".") != 
NULL && decimal_counter == 0) {
 
 
  199    const char *actual_value;
 
  201    if ((raw_value[0] == 
'+') || (raw_value[0] == 
'-')) {
 
  202        actual_value = &raw_value[1];
 
  205                " operator.\n", raw_value);
 
  209        actual_value = &raw_value[0];
 
 
  231            " character.\n", 
name);
 
 
  344            " in a set metric.\n", 
value);
 
 
  354    double numerical_rate = 1.0;
 
  365            "StatsD(metric_type,statistic_name,value[,sample_rate]). Sample rate is the " 
  366            "only optional parameter.\n");
 
  377    if (!strcmp(
args.metric_type, 
"g")) {
 
  383    else if (!strcmp(
args.metric_type, 
"c")) {
 
  389    else if (!strcmp(
args.metric_type, 
"ms")) {
 
  395    else if (!strcmp(
args.metric_type, 
"s")) {
 
  402    if (
args.sample_rate) {
 
  408        numerical_rate = strtod(
args.sample_rate, 
NULL);
 
 
  431    .
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.
static int statsd_exec(struct ast_channel *chan, const char *data)
static int determine_actual_value(const char *raw_value)
Determines the actual value of a number by looking for a leading + or -.
static int validate_numeric(const char *numeric_value)
Check to ensure that a numeric value is valid.
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 non_neg_value_range(const char *value)
Check to ensure the value is within the allowed range.
static int validate_name(const char *name)
Check to ensure the statistic name is valid.
static int value_in_range(const char *value)
Check to ensure the value is within the allowed range.
static int load_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 unload_module(void)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Support for logging to various files, console and syslog Configuration in file logger....
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
void AST_OPTIONAL_API_NAME() 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.
String manipulation functions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Main Channel structure associated with a channel.