function TracerProvider::__construct
Parameters
list<SpanProcessorInterface>|SpanProcessorInterface|null $spanProcessors :
File
-
vendor/
open-telemetry/ sdk/ Trace/ TracerProvider.php, line 28
Class
Namespace
OpenTelemetry\SDK\TraceCode
public function __construct(SpanProcessorInterface|array|null $spanProcessors = [], ?SamplerInterface $sampler = null, ?ResourceInfo $resource = null, ?SpanLimits $spanLimits = null, ?IdGeneratorInterface $idGenerator = null, ?InstrumentationScopeFactoryInterface $instrumentationScopeFactory = null, ?Configurator $configurator = null) {
$spanProcessors ??= [];
$spanProcessors = is_array($spanProcessors) ? $spanProcessors : [
$spanProcessors,
];
$resource ??= ResourceInfoFactory::defaultResource();
$sampler ??= new ParentBased(new AlwaysOnSampler());
$idGenerator ??= new RandomIdGenerator();
$spanLimits ??= (new SpanLimitsBuilder())->build();
$this->tracerSharedState = new TracerSharedState($idGenerator, $resource, $spanLimits, $sampler, $spanProcessors);
$this->instrumentationScopeFactory = $instrumentationScopeFactory ?? new InstrumentationScopeFactory(Attributes::factory());
$this->tracers = new WeakMap();
}