You are here

public static function StatsD::updateStats in StatsD 6

Same name and namespace in other branches
  1. 7.2 includes/statsd.inc \StatsD::updateStats()
  2. 7 includes/statsd.inc \StatsD::updateStats()

Updates one or more stats counters by arbitrary amounts.

Parameters

$stats: A string or an array of string representing the metric(s) to increment or decrement.

$delta: The amount to increment/decrement each metric by.

$sample_rate: A float between 0 and 1 representing the sampling rate.

Return value

boolean

3 calls to StatsD::updateStats()
StatsD::decrement in includes/statsd.inc
Decrements one or more stats counters.
StatsD::increment in includes/statsd.inc
Increments one or more stats counters
statsd_call in ./statsd.module
The generic statsd wrapper. Used for convenience.

File

includes/statsd.inc, line 85

Class

StatsD
Sends statistics to the stats daemon over UDP

Code

public static function updateStats($stats, $delta = 1, $sample_rate = NULL) {
  $data = array();
  if (!is_array($stats)) {
    $stats = array(
      $stats,
    );
  }
  foreach ($stats as $stat) {
    $data[$stat] = "{$delta}|c";
  }
  self::send($data, $sample_rate);
}