You are here

public static function StatsD::updateStats in StatsD 7

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

Updates one or more stats counters by arbitrary amounts.

Parameters

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

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

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

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 110

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);
}