You are here

public function StatsD::updateStats in StatsD 7.2

Same name and namespace in other branches
  1. 6 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

2 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

File

includes/statsd.inc, line 124

Class

StatsD
Sends statistics to the stats daemon over UDP.

Code

public 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";
  }
  $this
    ->send($data, $sample_rate);
}