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

Breadcrumb

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

class LocalRootSpan

@experimental

Hierarchy

  • class \OpenTelemetry\API\Trace\LocalRootSpan

Expanded class hierarchy of LocalRootSpan

File

vendor/open-telemetry/api/Trace/LocalRootSpan.php, line 14

Namespace

OpenTelemetry\API\Trace
View source
class LocalRootSpan {
    
    /**
     * Retrieve the local root span. This is the root-most active span which has
     * a remote or invalid parent.
     * If there is no active local root span, then an invalid span is returned.
     * @experimental
     */
    public static function current() : SpanInterface {
        return self::fromContext(Context::getCurrent());
    }
    
    /**
     * Retrieve the local root span from a Context.
     * @experimental
     */
    public static function fromContext(ContextInterface $context) : SpanInterface {
        return $context->get(self::key()) ?? Span::getInvalid();
    }
    
    /**
     * @internal
     */
    public static function store(ContextInterface $context, SpanInterface $span) : ContextInterface {
        return $context->with(self::key(), $span);
    }
    
    /**
     * @internal
     */
    public static function key() : ContextKeyInterface {
        static $key;
        return $key ??= Context::createKey(self::class);
    }
    
    /**
     * @internal
     */
    public static function isLocalRoot(ContextInterface $parentContext) : bool {
        $spanContext = Span::fromContext($parentContext)->getContext();
        return !$spanContext->isValid() || $spanContext->isRemote();
    }

}

Members

Title Sort descending Modifiers Object type Summary
LocalRootSpan::current public static function Retrieve the local root span. This is the root-most active span which has
a remote or invalid parent.
If there is no active local root span, then an invalid span is returned.
@experimental
LocalRootSpan::fromContext public static function Retrieve the local root span from a Context.
@experimental
LocalRootSpan::isLocalRoot public static function @internal
LocalRootSpan::key public static function @internal
LocalRootSpan::store public static function @internal

API Navigation

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