Beispiel #1
0
 /**
  * @param RenaApp $app
  */
 function __construct(RenaApp $app)
 {
     $this->config = $app->baseConfig;
     $connection = new UdpSocket($this->config->getConfig('server', 'statsd', '127.0.0.1'), $this->config->getConfig('port', 'statsd', 8125));
     $this->statsd = new Client($connection, $this->config->getConfig('namespace', 'statsd', 'rena.namespace'));
     // Global name space
     $this->statsd->setNamespace($this->config->getConfig('globalNamespace', 'statsd', 'rena'));
 }
Beispiel #2
0
 /**
  * Create a new Skeleton Instance
  */
 public function __construct()
 {
     if (strtolower(config('statscollector.mode')) == 'tcp') {
         $socketClass = "\\Domnikl\\Statsd\\Connection\\TcpSocket";
     } else {
         $socketClass = "\\Domnikl\\Statsd\\Connection\\UdpSocket";
     }
     $connection = new $socketClass(config('statscollector.host'), config('statscollector.port'));
     $this->client = new Client($connection, config('statscollector.ns'));
     if (config('statscollector.ns-prefix')) {
         $this->client->setNamespace(config('statscollector.ns-prefix'));
     }
     $envs = explode(',', config('statscollector.environments'));
     $this->environments = array_map('trim', $envs);
     $this->methods = ['increment', 'decrement', 'count', 'timing', 'time', 'startTiming', 'endTiming', 'memory', 'startMemoryProfile', 'endMemoryProfile', 'gauge', 'set'];
 }
 public function testNamespace()
 {
     $client = new Client(new ConnectionMock(), 'test.foo');
     $this->assertEquals('test.foo', $client->getNamespace());
     $client->setNamespace('bar.baz');
     $this->assertEquals('bar.baz', $client->getNamespace());
 }
Beispiel #4
0
 /**
  * @inheritdoc
  */
 public function setNamespace($namespace)
 {
     $this->client->setNamespace($namespace);
 }