You are here

function statsd_call in StatsD 7

Same name and namespace in other branches
  1. 6 statsd.module \statsd_call()
  2. 7.2 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.

5 calls to statsd_call()
statsd_exit in ./statsd.module
Implements hook_exit().
statsd_logger_event in ./statsd.module
Implements hook_logger_event().
statsd_user_login in ./statsd.module
Implements hook_user_login().
statsd_user_login_failed in ./statsd.module
Send a failed login attempt.
statsd_watchdog in ./statsd.module
Implements hook_watchdog().

File

./statsd.module, line 154

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.
  require_once __DIR__ . '/includes/statsd.inc';
  switch ($type) {
    case 'count':
      StatsD::updateStats($name, $value);
      break;
    case 'increment':
      StatsD::updateStats($name, $value ?: 1);
      break;
    case 'decrement':
      StatsD::updateStats($name, $value ?: -1);
      break;
    case 'gauge':
      StatsD::gauge($name, $value);
      break;
    case 'set':
      StatsD::set($name, $value);
      break;
    case 'time':
    case 'timing':
      StatsD::timing($name, $value);
      break;
    default:
      watchdog('statsd', 'Unknown method called for statsd: %type', array(
        '%type' => $type,
      ), WATCHDOG_WARNING);
      break;
  }
}