You are here

public function RequestSubscriber::onTerminate in Raven: Sentry Integration 3.x

Performance tracing.

@todo In Drupal 9+ the event should actually be TerminateEvent.

File

src/EventSubscriber/RequestSubscriber.php, line 115

Class

RequestSubscriber
Initializes Raven logger so Sentry functions can be called.

Namespace

Drupal\raven\EventSubscriber

Code

public function onTerminate(KernelEvent $event) {
  if (!$this->transaction) {
    return;
  }
  if (method_exists($event, 'getResponse')) {
    $this->transaction
      ->setHttpStatus($event
      ->getResponse()
      ->getStatusCode());
  }
  if ($this->configFactory
    ->get('raven.settings')
    ->get('database_tracing')) {
    $this
      ->collectDatabaseLog();
  }
  $this->transaction
    ->finish();
}