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

Breadcrumb

  1. Drupal Core 11.1.x

LateBindingTracerProvider.php

Namespace

OpenTelemetry\API\Trace

File

vendor/open-telemetry/api/Trace/LateBindingTracerProvider.php

View source
<?php

declare (strict_types=1);
namespace OpenTelemetry\API\Trace;

use Closure;

/**
 * Late binding providers are designed to be used by Instrumentation, while we do not have control over when all components (propagators, etc)
 * which are registered through composer.autoload.files are actually loaded. It means that tracers etc are not fetched
 * from Globals until the last possible instant (ie, when they try to create a span, get an instrument, etc).
 * In the future, when everything uses SPI, this will be removed.
 */
class LateBindingTracerProvider implements TracerProviderInterface {
    private ?TracerProviderInterface $tracerProvider = null;
    
    /** @param Closure(): TracerProviderInterface $factory */
    public function __construct(Closure $factory) {
    }
    public function getTracer(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []) : TracerInterface {
        return $this->tracerProvider?->getTracer($name, $version, $schemaUrl, $attributes) ?? new LateBindingTracer(fn(): TracerInterface => ($this->tracerProvider ??= ($this->factory)())
            ->getTracer($name, $version, $schemaUrl, $attributes));
    }

}

Classes

Title Deprecated Summary
LateBindingTracerProvider Late binding providers are designed to be used by Instrumentation, while we do not have control over when all components (propagators, etc) which are registered through composer.autoload.files are actually loaded. It means that tracers etc are not…

API Navigation

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