/** * Handle the observable events we get passed * * @param string $event * @param array $args */ public function __call($event, array $args) { // ignore it if we don't care about this event if (!in_array($event, $this->care)) { return; } $model = array_shift($args); $metric = trim(str_replace('\\', '/', $this->name ?: get_class($model)), '/'); $name = 'Custom/Counts/' . $metric . '/' . $event; /** * NewRelic assumes custom metrics to be in milliseconds, so 4 gets interpreted as * .004. So each "count" increment is 1000 to display properly in custom dashboards. */ \Newrelic::customMetric($name, 1000); }
/** * Record the time it took to restore * * @param Illuminate\Database\Eloquent\Model $model */ public function restored($model) { if (!in_array('restored', $this->care)) { return; } $ms = round(static::$times['restore'] + microtime(true), 3) * 1000; \Newrelic::customMetric($this->getMetricName($model, 'restored'), $ms); }
/* |-------------------------------------------------------------------------- | Register The Laravel Class Loader |-------------------------------------------------------------------------- | | In addition to using Composer, you may use the Laravel class loader to | load your controllers and models. This is useful for keeping all of | your classes in the "global" namespace without Composer updating. | */ ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds')); /** * New relic App */ Newrelic::setAppName(Config::get('laravel-newrelic::app_name')); /** * Custom validator */ // Register Api key validator Validator::resolver(function ($translator, $data, $rules, $messages) { return new CustomValidator($translator, $data, $rules, $messages); }); /* |-------------------------------------------------------------------------- | Application Error Logger |-------------------------------------------------------------------------- | | Here we will configure the error logger setup for the application which | is built on top of the wonderful Monolog library. By default we will | build a rotating log file setup which creates a new file each day.