You are here

public static function StatsD::set in StatsD 7

Sends one or more set values to statsd.

Sets count the number of unique values received during the flush interval.

Parameters

string $stat: The metric name.

mixed $values: The value (or array of values) to send for this metric.

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

1 call to StatsD::set()
statsd_call in ./statsd.module
The generic statsd wrapper. Used for convenience.

File

includes/statsd.inc, line 56

Class

StatsD
Sends statistics to the stats daemon over UDP

Code

public static function set($stat, $values, $sample_rate = NULL) {
  $data = array();
  if (!is_array($values)) {
    $values = array(
      $values,
    );
  }
  foreach ($values as $value) {
    $data[$stat] = "{$value}|s";
  }
  self::send($data, $sample_rate);
}