/**
  * @return \Exolnet\Instruments\Drivers\StatsdDriver
  */
 protected function createStatsdDriver()
 {
     $options = config('instruments.statsd') + ['namespace' => $this->getNamespace()];
     $client = new Client();
     $client->configure($options);
     return new StatsdDriver($client);
 }
Ejemplo n.º 2
0
 /**
  * Register Service Provider
  * @param Application $app Silex application instance
  */
 public function register(Application $app)
 {
     $app['statsd'] = $app->share(function () use($app) {
         // Set Default host and port
         $options = array();
         if (isset($app['statsd.host'])) {
             $options['host'] = $app['statsd.host'];
         }
         if (isset($app['statsd.port'])) {
             $options['port'] = $app['statsd.port'];
         }
         if (isset($app['statsd.namespace'])) {
             $options['namespace'] = $app['statsd.namespace'];
         }
         // Create
         $statsd = new StatsdClient();
         $statsd->configure($options);
         return $statsd;
     });
 }
Ejemplo n.º 3
0
 /**
  * Register Statsd
  *
  * @return void
  */
 protected function registerStatsD()
 {
     $this->app['statsd'] = $this->app->share(function ($app) {
         // Set Default host and port
         $options = array();
         if (isset($app['config']['statsd.host'])) {
             $options['host'] = $app['config']['statsd.host'];
         }
         if (isset($app['config']['statsd.port'])) {
             $options['port'] = $app['config']['statsd.port'];
         }
         if (isset($app['config']['statsd.namespace'])) {
             $options['namespace'] = $app['config']['statsd.namespace'];
         }
         // Create
         $statsd = new Statsd();
         $statsd->configure($options);
         return $statsd;
     });
 }