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

Breadcrumb

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

class Tracer

Hierarchy

  • class \OpenTelemetry\SDK\Trace\Tracer implements \API\TracerInterface

Expanded class hierarchy of Tracer

File

vendor/open-telemetry/sdk/Trace/Tracer.php, line 14

Namespace

OpenTelemetry\SDK\Trace
View source
class Tracer implements API\TracerInterface {
    public const FALLBACK_SPAN_NAME = 'empty';
    private Config $config;
    public function __construct(TracerSharedState $tracerSharedState, InstrumentationScopeInterface $instrumentationScope, ?Configurator $configurator = null) {
        $this->config = $configurator ? $configurator->resolve($this->instrumentationScope) : TracerConfig::default();
    }
    
    /** @inheritDoc */
    public function spanBuilder(string $spanName) : API\SpanBuilderInterface {
        if (ctype_space($spanName)) {
            $spanName = self::FALLBACK_SPAN_NAME;
        }
        // If a Tracer is disabled, it MUST behave equivalently to No-op Tracer
        if (!$this->config
            ->isEnabled() || $this->tracerSharedState
            ->hasShutdown()) {
            return new API\NoopSpanBuilder(Context::storage());
        }
        return new SpanBuilder($spanName, $this->instrumentationScope, $this->tracerSharedState);
    }
    public function getInstrumentationScope() : InstrumentationScopeInterface {
        return $this->instrumentationScope;
    }
    public function isEnabled() : bool {
        return $this->config
            ->isEnabled();
    }
    public function updateConfig(Configurator $configurator) : void {
        $this->config = $configurator->resolve($this->instrumentationScope);
    }

}

Members

Title Sort descending Modifiers Object type Summary
Tracer::$config private property
Tracer::FALLBACK_SPAN_NAME public constant
Tracer::getInstrumentationScope public function
Tracer::isEnabled public function
Tracer::spanBuilder public function @inheritDoc
Tracer::updateConfig public function
Tracer::__construct public function
RSS feed
Powered by Drupal