Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. functions.php

function trace

Executes the given closure within the provided span.

The span will be ended.

@template R

@phpstan-ignore-next-line

Parameters

SpanInterface $span span to enclose the closure with:

Closure(...): R $closure closure to invoke:

iterable<int|string, mixed> $args arguments to provide to the closure:

Return value

R result of the closure invocation

13 string references to 'trace'
ControllerDoesNotReturnResponseException::__construct in vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php
CsrfRequestHeaderAccessCheck::access in core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php
Checks access.
CsrfRequestHeaderAccessCheck::applies in core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php
Declares whether the access check applies to a specific route or not.
ErrorHandler::__construct in vendor/symfony/error-handler/ErrorHandler.php
ExceptionCaster::castThrowingCasterException in vendor/symfony/var-dumper/Caster/ExceptionCaster.php

... See full list

File

vendor/open-telemetry/api/Trace/functions.php, line 23

Namespace

OpenTelemetry\API\Trace

Code

function trace(SpanInterface $span, Closure $closure, iterable $args = []) {
    $s = $span;
    $c = $closure;
    $a = $args;
    unset($span, $closure, $args);
    $scope = $s->activate();
    try {
        
        /** @psalm-suppress InvalidArgument */
        return $c(...$a, ...$a = []);
    } catch (Throwable $e) {
        $s->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
        $s->recordException($e, [
            'exception.escaped' => true,
        ]);
        throw $e;
    } finally {
        $scope->detach();
        $s->end();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal