You are here

protected static function StatsD::prefixData in StatsD 7

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

Create the data strings that will be passed into statsd.

Parameters

$data: An array of key value pairs to prefix.

Return value

array

1 call to StatsD::prefixData()
StatsD::send in includes/statsd.inc
Squirt the metrics over UDP.

File

includes/statsd.inc, line 185

Class

StatsD
Sends statistics to the stats daemon over UDP

Code

protected static function prefixData($data) {
  $prefix = ($prefix = variable_get('statsd_prefix', NULL)) ? $prefix . '.' : '';
  $suffix = ($suffix = variable_get('statsd_suffix', NULL)) ? '.' . $suffix : '';
  $return = array();
  foreach ($data as $key => $value) {
    $name = $prefix . $key . $suffix;
    $return[$name] = $value;
  }
  return $return;
}