function Registry::transportFactory
Get transport factory registered for protocol. If $protocol contains a content-type eg `http/xyz` then only the first part, `http`, is used.
3 calls to Registry::transportFactory()
- LogsExporterFactory::buildTransport in vendor/
open-telemetry/ exporter-otlp/ LogsExporterFactory.php - @psalm-suppress UndefinedClass
- MetricExporterFactory::buildTransport in vendor/
open-telemetry/ exporter-otlp/ MetricExporterFactory.php - @psalm-suppress UndefinedClass
- SpanExporterFactory::buildTransport in vendor/
open-telemetry/ exporter-otlp/ SpanExporterFactory.php - @psalm-suppress ArgumentTypeCoercion @psalm-suppress UndefinedClass
File
-
vendor/
open-telemetry/ sdk/ Registry.php, line 155
Class
- Registry
- A registry to enable central registration of components that the SDK requires but which may be provided by non-SDK modules, such as contrib and extension. @todo [breaking] deprecate this mechanism of setting up components, in favor of using SPI.
Namespace
OpenTelemetry\SDKCode
public static function transportFactory(string $protocol) : TransportFactoryInterface {
$protocol = explode('/', $protocol)[0];
if (!array_key_exists($protocol, self::$transportFactories)) {
throw new RuntimeException('Transport factory not defined for protocol: ' . $protocol);
}
$class = self::$transportFactories[$protocol];
$factory = is_callable($class) ? $class : new $class();
assert($factory instanceof TransportFactoryInterface);
return $factory;
}