/** * Exception error handler * * @param GetResponseForExceptionEvent $event * * @return void */ public function onKernelException(GetResponseForExceptionEvent $event) { if ($this->isIgnored($event->getException())) { return; } if ($this->mailer) { $this->mailer->sendException($event->getRequest(), $event->getException()); } if ($this->statsd) { $this->statsd->increment("exception"); } }
/** * @param FilterResponseEvent $event */ public function onCoreResponse(FilterResponseEvent $event) { if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { $this->profiler->stopProfiling(); if ($this->profiling) { $timers = $this->profiler->getTimers(); $requestTime = microtime(true) - $this->start; $timers['request'] = (int) ($requestTime * 1000); $counters = $this->profiler->getCounters(); $counters['request'] = 1; if ($this->statsd) { $sample = $this->sampling / 100; $route = $event->getRequest()->attributes->get('_route'); foreach ($timers as $key => $value) { $this->statsd->timing($key, $value, $sample); if ($route) { $this->statsd->timing("per_route.{$key}.{$route}", $value, $sample); } } foreach ($counters as $key => $value) { $this->statsd->updateStats($key, $value, $sample); if ($route) { $this->statsd->updateStats("per_route.{$key}.{$route}", $value, $sample); } } } if ($this->logger) { $this->logger->log($event->getRequest(), $timers, $counters); } } } }