You are here

function statsd_call in StatsD 7.2

Same name and namespace in other branches
  1. 6 statsd.module \statsd_call()
  2. 7 statsd.module \statsd_call()

The generic statsd wrapper. Used for convenience.

Parameters

$name: Name of the value you want to track.

$type: The type of action you want to take with the value.

$value: The numeric value you wish to pass to statsd.

4 calls to statsd_call()
statsd_exit in ./statsd.module
Implementation of hook_exit()
statsd_user_login in ./statsd.module
Implementation of hook_user_login()
statsd_user_login_failed in ./statsd.module
Send failed login attempt
statsd_watchdog in ./statsd.module
Implementation of hook_watchdog()

File

./statsd.module, line 132

Code

function statsd_call($name, $type = 'increment', $value = NULL) {

  // In certain situations, hook_watchdog() is called early in the bootstrap
  // process before autoloaded classes are available.
  module_load_include('inc', 'statsd', 'includes/statsd');
  $statsd = statsd_instance();
  switch ($type) {
    case 'increment':
      $statsd
        ->updateStats($name, isset($value) ? $value : 1);
      break;
    case 'decrement':
      $statsd
        ->updateStats($name, isset($value) ? $value : -1);
      break;
    case 'gauge':
      $statsd
        ->gauge($name, $value);
      break;
    case 'timing':
      $statsd
        ->timing($name, $value);
      break;
    default:
      watchdog('statsd', 'Unknown method called for statsd: %type', array(
        '%type' => $type,
      ), WATCHDOG_WARNING);
      break;
  }
}