function Configurator::storeInContext
Overrides ImplicitContextKeyedInterface::storeInContext
File
-
vendor/
open-telemetry/ api/ Instrumentation/ Configurator.php, line 66
Class
- Configurator
- Configures the global (context scoped) instrumentation instances.
Namespace
OpenTelemetry\API\InstrumentationCode
public function storeInContext(?ContextInterface $context = null) : ContextInterface {
$context ??= Context::getCurrent();
if ($this->tracerProvider !== null) {
$context = $context->with(ContextKeys::tracerProvider(), $this->tracerProvider);
}
if ($this->meterProvider !== null) {
$context = $context->with(ContextKeys::meterProvider(), $this->meterProvider);
}
if ($this->propagator !== null) {
$context = $context->with(ContextKeys::propagator(), $this->propagator);
}
if ($this->loggerProvider !== null) {
$context = $context->with(ContextKeys::loggerProvider(), $this->loggerProvider);
}
if ($this->eventLoggerProvider !== null) {
$context = $context->with(ContextKeys::eventLoggerProvider(), $this->eventLoggerProvider);
}
return $context;
}