You are here

public function TwigTracingExtension::enter in Raven: Sentry Integration 3.x

This method is called before execution.

Parameters

\Twig\Profiler\Profile $profile: The profiling data.

File

src/Twig/TwigTracingExtension.php, line 47

Class

TwigTracingExtension
Provides Twig performance tracing.

Namespace

Drupal\raven\Twig

Code

public function enter(Profile $profile) : void {
  if (!$this->configFactory
    ->get('raven.settings')
    ->get('twig_tracing') || !class_exists(SentrySdk::class)) {
    return;
  }
  $transaction = SentrySdk::getCurrentHub()
    ->getTransaction();
  if (NULL === $transaction) {
    return;
  }
  $spanContext = new SpanContext();
  $spanContext
    ->setOp('twig.render');
  $spanContext
    ->setDescription($this
    ->getSpanDescription($profile));
  $this->spans[$profile] = $transaction
    ->startChild($spanContext);
}