You are here

protected function StatsD::prefixData in StatsD 7.2

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

Class

StatsD
Sends statistics to the stats daemon over UDP.

Code

protected function prefixData($data) {
  $prefix = $this->prefix ? $this->prefix . '.' : '';
  $suffix = $this->suffix ? '.' . $this->suffix : '';
  $return = array();
  foreach ($data as $key => $value) {
    $name = sprintf('%s' . $key . '%s', $prefix, $suffix);
    $return[$name] = $value;
  }
  return $return;
}