/** * 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); }