You are here

protected function StatsD::prefixData in StatsD 6

Same name and namespace in other branches
  1. 7.2 includes/statsd.inc \StatsD::prefixData()
  2. 7 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.

1 call to StatsD::prefixData()
StatsD::send in includes/statsd.inc

File

includes/statsd.inc, line 152

Class

StatsD
Sends statistics to the stats daemon over UDP

Code

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