Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use SPI to manage components #1412

Open
wants to merge 49 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
abd9944
generate registry from composer autoload-dump
brettmc Oct 18, 2024
43ebe82
use SPI to configure registry
brettmc Oct 22, 2024
8e17eaa
fix b3
brettmc Oct 22, 2024
d252d31
don't static init registry from SPI. add tests
brettmc Oct 23, 2024
d0fb06c
always use SPI
brettmc Oct 28, 2024
b157de2
tidy registry
brettmc Oct 28, 2024
98c1ce0
remove phan suppressions
brettmc Oct 28, 2024
663998d
dont define built-in propagators in SPI
brettmc Oct 28, 2024
77b5d7c
update examples
brettmc Oct 28, 2024
9f7d95b
formatting, remove unused factories
brettmc Oct 28, 2024
5ffe83b
tidy
brettmc Oct 28, 2024
95edf15
generate registry from composer autoload-dump
brettmc Oct 18, 2024
8f26132
use SPI to configure registry
brettmc Oct 22, 2024
b07b16a
fix b3
brettmc Oct 22, 2024
3481905
don't static init registry from SPI. add tests
brettmc Oct 23, 2024
9475249
always use SPI
brettmc Oct 28, 2024
93829f3
tidy registry
brettmc Oct 28, 2024
0d8662d
remove phan suppressions
brettmc Oct 28, 2024
1744c84
dont define built-in propagators in SPI
brettmc Oct 28, 2024
fa1b678
update examples
brettmc Oct 28, 2024
af53feb
formatting, remove unused factories
brettmc Oct 28, 2024
0af0b54
tidy
brettmc Oct 28, 2024
37f8176
remove blank lines after class opening (#1468)
brettmc Jan 7, 2025
b90344e
adding otlp/file exporter (#1465)
brettmc Jan 8, 2025
b4484c4
deprecate event logger (#1466)
brettmc Jan 8, 2025
5a0dc98
use SPI for stdout otlp exporters
brettmc Jan 9, 2025
eb256a2
Merge branch '2.x' into composer-extra-registry
brettmc Jan 9, 2025
4cdc497
Merge branch 'composer-extra-registry' of github.com:brettmc/opentele…
brettmc Jan 9, 2025
4e3a60c
fix merge conflict
brettmc Jan 9, 2025
b3cd9f3
remove otlphttp transport factory, in favour of psr transport factory
brettmc Jan 9, 2025
0df5bcf
remove registerXXX methods from Registry
brettmc Jan 9, 2025
0708e47
move Registry to common/service/loader
brettmc Jan 9, 2025
4159f2e
Merge branch '2.x' into composer-extra-registry
brettmc Jan 10, 2025
01e7c70
add stdout exporters to SPI, remove otlphttp transport factory from SPI
brettmc Jan 10, 2025
24b72bd
use spi.prune_autoload_files=true where possible
brettmc Jan 10, 2025
e33845b
fix composer.json, add upgrading guide
brettmc Jan 10, 2025
7dbe592
simplify resource detector loading
brettmc Jan 13, 2025
b506de9
use _register.php to register SPI classes
brettmc Jan 13, 2025
9b96b79
use _register.php to register SPI classes
brettmc Jan 13, 2025
ed836e9
tidy up service loader
brettmc Jan 13, 2025
63264fd
simplify services loader code
brettmc Jan 13, 2025
4f24708
register and use API propagators through SPI
brettmc Jan 13, 2025
540243e
Merge branch 'composer-extra-registry' of github.com:brettmc/opentele…
brettmc Jan 13, 2025
b7b9ca1
filter out 'none' compression
brettmc Jan 13, 2025
ff3299c
update upgrading docs
brettmc Jan 13, 2025
b7af73d
move type() and priority() into a shared interface
brettmc Jan 13, 2025
a8fc516
factory test coverage
brettmc Jan 13, 2025
3e80235
tests, configure bypass-finals
brettmc Jan 13, 2025
93f25f8
coverage
brettmc Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ update: ## Update dependencies
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update
update-lowest: ## Update dependencies to lowest supported versions
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update --prefer-lowest
dump: ## Dump autoload
$(DC_RUN_PHP) env XDEBUG_MODE=off composer dump-autoload
test: test-unit test-integration ## Run unit and integration tests
test-unit: ## Run unit tests
$(DC_RUN_PHP) env XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite unit --colors=always
Expand Down
64 changes: 23 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@
"files": [
"src/Context/fiber/initialize_fiber_handler.php",
"src/API/Trace/functions.php",
"src/Config/SDK/_register.php",
"src/Contrib/Otlp/_register.php",
"src/Contrib/Grpc/_register.php",
"src/Contrib/Zipkin/_register.php",
"src/Extension/Propagator/B3/_register.php",
"src/Extension/Propagator/CloudTrace/_register.php",
"src/Extension/Propagator/Jaeger/_register.php",
"src/SDK/Logs/Exporter/_register.php",
"src/SDK/Metrics/MetricExporter/_register.php",
"src/SDK/Propagation/_register.php",
"src/SDK/Trace/SpanExporter/_register.php",
"src/SDK/_register.php",
"src/SDK/Common/Dev/Compatibility/_load.php",
"src/SDK/Common/Util/functions.php",
"src/SDK/_autoload.php"
Expand Down Expand Up @@ -123,51 +121,35 @@
"target-directory": "vendor-bin",
"forward-command": true
},
"spi-config": {
"autoload-files": true,
"prune-autoload-files": [
"src/Contrib/Otlp/_register.php",
"src/Contrib/Grpc/_register.php",
"src/Contrib/Zipkin/_register.php",
"src/Extension/Propagator/B3/_register.php",
"src/Extension/Propagator/CloudTrace/_register.php",
"src/Extension/Propagator/Jaeger/_register.php",
"src/SDK/_register.php"
]
},
"spi": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use extra.spi-config.autoload-files and remove the extra.spi entries to load the service providers from _register.phps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved most of these to an appropriate _register.php, excepting some test instances and the API's ExtensionHookManager...

"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [
"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\ExtensionHookManager"
],
"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\Instrumentation": [
"OpenTelemetry\\Example\\ExampleInstrumentation"
],
"OpenTelemetry\\SDK\\Resource\\ResourceDetectorFactoryInterface": [
"OpenTelemetry\\Example\\TestResourceDetectorFactory"
],
"OpenTelemetry\\Config\\SDK\\Configuration\\ComponentProvider": [
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorB3",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorB3Multi",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorBaggage",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorComposite",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorJaeger",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Propagator\\TextMapPropagatorTraceContext",

"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SamplerAlwaysOff",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SamplerAlwaysOn",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SamplerParentBased",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SamplerTraceIdRatioBased",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SpanExporterConsole",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SpanExporterOtlp",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SpanExporterZipkin",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SpanProcessorBatch",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Trace\\SpanProcessorSimple",

"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Metrics\\AggregationResolverDefault",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Metrics\\MetricExporterConsole",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Metrics\\MetricExporterOtlp",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Metrics\\MetricReaderPeriodic",

"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Logs\\LogRecordExporterConsole",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Logs\\LogRecordExporterOtlp",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Logs\\LogRecordProcessorBatch",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Logs\\LogRecordProcessorSimple",

"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Instrumentation\\General\\HttpConfigProvider",
"OpenTelemetry\\Config\\SDK\\ComponentProvider\\Instrumentation\\General\\PeerConfigProvider",

"OpenTelemetry\\Example\\ExampleConfigProvider",

"OpenTelemetry\\Tests\\Integration\\Config\\ComponentProvider\\Metrics\\AggregationResolverExplicitBucketHistogram",
"OpenTelemetry\\Tests\\Integration\\Config\\ComponentProvider\\Metrics\\MetricExporterPrometheus",
"OpenTelemetry\\Tests\\Integration\\Config\\ComponentProvider\\Metrics\\MetricReaderPull",
"OpenTelemetry\\Tests\\Integration\\Config\\ComponentProvider\\Propagator\\TextMapPropagatorXray",
"OpenTelemetry\\Tests\\Integration\\Config\\ComponentProvider\\Propagator\\TextMapPropagatorOtTrace"
],
"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [
"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\ExtensionHookManager"
],
"OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\Instrumentation": [
"OpenTelemetry\\Example\\ExampleInstrumentation"
]
}
}
Expand Down
6 changes: 0 additions & 6 deletions deptrac.baseline.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
deptrac:
skip_violations:
/src/Extension/Propagator/B3/_register.php:
- OpenTelemetry\SDK\Registry
/src/Extension/Propagator/CloudTrace/_register.php:
- OpenTelemetry\SDK\Registry
/src/Extension/Propagator/Jaeger/_register.php:
- OpenTelemetry\SDK\Registry
1 change: 1 addition & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ deptrac:
- Prometheus
Extension:
- +API
- SDK
OtelProto:
- GoogleProtobuf
- Grpc
29 changes: 29 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Upgrading notes for major versions

## 1.x -> 2.x

### API

### SDK

#### SDK\Registry removed
`SDK\Registry` has been removed, and the technique of registering components (eg propagators, transports,
auto-instrumentations) has been replaced with [Nevay/SPI](https://github.com/Nevay/spi/) ServiceLoader.

The ServiceLoader should be configured through existing `_register.php` files, which should *only* contain calls to
SPI's `ServiceLoader::register()` method.

SPI has a composer plugin which will scan for `ServiceLoader::register()` calls in `autoload.files` and generate a
`GeneratedServiceProviderData.php` file in `vendor/composer/`. The plugin will then remove those `autoload.files` entries
from composer's generated output to avoid double-loading.
Pre-generating the services in this way avoids a race-condition in 1.x where composer's `autoload.files` are executed in an
undefined order, and services may not be registered in time for the SDK to use them.

For SPI to work correctly, the composer plugin _should_ be allowed to run. If the plugin is not allowed to run, then
services will still register at runtime, however this might still suffer from the same race-condition as `1.x`.

#### FactoryInterfaces updated
Various component factory interfaces (eg `TextMapPropagatorFactoryInterface`, `TransportFactoryInterface`) have been
updated to include `priority()` and `type()` methods. These are used in conjunction with SPI ServiceLoader to associate
a type (eg `otlp`) with a factory, and to allow SDK-provided factories to be replaced by user-provided factories (by
providing a higher priority for the same type).
15 changes: 14 additions & 1 deletion examples/autoload_sdk_with_custom_transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace OpenTelemetry\Example;

use Nevay\SPI\ServiceLoader;
use OpenTelemetry\SDK\Common\Export\TransportFactoryInterface;

putenv('OTEL_PHP_AUTOLOAD_ENABLED=true');
putenv('OTEL_TRACES_EXPORTER=otlp');
putenv('OTEL_EXPORTER_OTLP_PROTOCOL=grpc');
Expand Down Expand Up @@ -45,9 +48,19 @@ public function forceFlush(?\OpenTelemetry\SDK\Common\Future\CancellationInterfa
}
};
}

public function type(): string
{
return 'grpc';
}

public function priority(): int
{
return 100;
}
};

\OpenTelemetry\SDK\Registry::registerTransportFactory('grpc', $factory, true);
ServiceLoader::register(TransportFactoryInterface::class, $factory::class);

$instrumentation = new \OpenTelemetry\API\Instrumentation\CachedInstrumentation('demo');

Expand Down
4 changes: 2 additions & 2 deletions examples/logs/exporters/otlp_http.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use OpenTelemetry\API\Logs\LogRecord;
use OpenTelemetry\API\Logs\Severity;
use OpenTelemetry\Contrib\Otlp\LogsExporter;
use OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory;
use OpenTelemetry\SDK\Common\Export\Http\PsrTransportFactory;
use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeFactory;
use OpenTelemetry\SDK\Logs\EventLoggerProvider;
use OpenTelemetry\SDK\Logs\LoggerProvider;
Expand All @@ -16,7 +16,7 @@

require __DIR__ . '/../../../vendor/autoload.php';

$transport = (new OtlpHttpTransportFactory())->create('http://collector:4318/v1/logs', 'application/json');
$transport = (new PsrTransportFactory())->create('http://collector:4318/v1/logs', 'application/json');
$exporter = new LogsExporter($transport);

$loggerProvider = new LoggerProvider(
Expand Down
5 changes: 5 additions & 0 deletions examples/src/ExampleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ public function __construct(
public readonly bool $enabled = true,
) {
}

public static function default(): self
{
return new self('example');
}
}
3 changes: 1 addition & 2 deletions examples/src/ExampleInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace OpenTelemetry\Example;

use Exception;
use OpenTelemetry\API\Configuration\ConfigProperties;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\Context as InstrumentationContext;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\HookManagerInterface;
Expand All @@ -16,7 +15,7 @@ final class ExampleInstrumentation implements Instrumentation
{
public function register(HookManagerInterface $hookManager, ConfigProperties $configuration, InstrumentationContext $context): void
{
$config = $configuration->get(ExampleConfig::class) ?? throw new Exception('example instrumentation must be configured');
$config = $configuration->get(ExampleConfig::class) ?? ExampleConfig::default();
if (!$config->enabled) {
return;
}
Expand Down
22 changes: 22 additions & 0 deletions examples/src/TestResourceDetector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace OpenTelemetry\Example;

use OpenTelemetry\SDK\Common\Attribute\Attributes;
use OpenTelemetry\SDK\Resource\ResourceDetectorInterface;
use OpenTelemetry\SDK\Resource\ResourceInfo;
use OpenTelemetry\SemConv\ResourceAttributes;

class TestResourceDetector implements ResourceDetectorInterface
{
public function getResource(): ResourceInfo
{
$attributes = [
'test-resource' => 'test-value',
];

return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);
}
}
26 changes: 26 additions & 0 deletions examples/src/TestResourceDetectorFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace OpenTelemetry\Example;

use OpenTelemetry\SDK\Resource\ResourceDetectorFactoryInterface;
use OpenTelemetry\SDK\Resource\ResourceDetectorInterface;

class TestResourceDetectorFactory implements ResourceDetectorFactoryInterface
{
public function create(): ResourceDetectorInterface
{
return new TestResourceDetector();
}

public function type(): string
{
return 'test';
}

public function priority(): int
{
return 0;
}
}
4 changes: 2 additions & 2 deletions examples/traces/exporters/otlp_http.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

require __DIR__ . '/../../../vendor/autoload.php';

use OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use OpenTelemetry\SDK\Common\Export\Http\PsrTransportFactory;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;

$transport = (new OtlpHttpTransportFactory())->create('http://collector:4318/v1/traces', 'application/x-protobuf');
$transport = (new PsrTransportFactory())->create('http://collector:4318/v1/traces', 'application/x-protobuf');
$exporter = new SpanExporter($transport);

echo 'Starting OTLP example';
Expand Down
4 changes: 2 additions & 2 deletions examples/traces/exporters/otlp_http_json.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
require __DIR__ . '/../../../vendor/autoload.php';

use OpenTelemetry\Contrib\Otlp\ContentTypes;
use OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use OpenTelemetry\SDK\Common\Export\Http\PsrTransportFactory;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;

$transport = (new OtlpHttpTransportFactory())->create('http://collector:4318/v1/traces', ContentTypes::JSON);
$transport = (new PsrTransportFactory())->create('http://collector:4318/v1/traces', ContentTypes::JSON);
$exporter = new SpanExporter($transport);

echo 'Starting OTLP+json example';
Expand Down
3 changes: 3 additions & 0 deletions examples/traces/features/auto_root_span.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
putenv('OTEL_TRACES_EXPORTER=console');
putenv('OTEL_METRICS_EXPORTER=none');
putenv('OTEL_LOGS_EXPORTER=console');
putenv('OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318');
putenv('OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf');
putenv('OTEL_PROPAGATORS=tracecontext');
putenv('OTEL_PHP_EXPERIMENTAL_AUTO_ROOT_SPAN=true');
putenv('OTEL_PHP_DETECTORS=sdk,test');

//Usage: php -S localhost:8080 examples/traces/features/auto_root_span.php

Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ parameters:
-
message: "#.*return with type T is not subtype.*#"
paths:
- src/SDK/Common/InstrumentationScope
- src/SDK/Common/InstrumentationScope
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use OpenTelemetry\Config\SDK\Configuration\ComponentProvider;
use OpenTelemetry\Config\SDK\Configuration\ComponentProviderRegistry;
use OpenTelemetry\Config\SDK\Configuration\Context;
use OpenTelemetry\SDK\Common\Services\Loader;
use OpenTelemetry\SDK\Logs\Exporter\ConsoleExporter;
use OpenTelemetry\SDK\Logs\LogRecordExporterInterface;
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

Expand All @@ -23,7 +23,7 @@ final class LogRecordExporterConsole implements ComponentProvider
*/
public function createPlugin(array $properties, Context $context): LogRecordExporterInterface
{
return new ConsoleExporter(Registry::transportFactory('stream')->create(
return new ConsoleExporter(Loader::transportFactory('stream')->create(
endpoint: 'php://stdout',
contentType: 'application/json',
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use OpenTelemetry\Contrib\Otlp\OtlpUtil;
use OpenTelemetry\Contrib\Otlp\Protocols;
use OpenTelemetry\SDK\Common\Configuration\Parser\MapParser;
use OpenTelemetry\SDK\Common\Services\Loader;
use OpenTelemetry\SDK\Logs\LogRecordExporterInterface;
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

Expand Down Expand Up @@ -45,7 +45,7 @@ public function createPlugin(array $properties, Context $context): LogRecordExpo

$headers = array_column($properties['headers'], 'value', 'name') + MapParser::parse($properties['headers_list']);

return new LogsExporter(Registry::transportFactory($protocol)->create(
return new LogsExporter(Loader::transportFactory($protocol)->create(
endpoint: $properties['endpoint'] . OtlpUtil::path(Signals::LOGS, $protocol),
contentType: Protocols::contentType($protocol),
headers: $headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use OpenTelemetry\Contrib\Otlp\OtlpUtil;
use OpenTelemetry\Contrib\Otlp\Protocols;
use OpenTelemetry\SDK\Common\Configuration\Parser\MapParser;
use OpenTelemetry\SDK\Common\Services\Loader;
use OpenTelemetry\SDK\Metrics\Data\Temporality;
use OpenTelemetry\SDK\Metrics\MetricExporterInterface;
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

Expand Down Expand Up @@ -54,7 +54,7 @@ public function createPlugin(array $properties, Context $context): MetricExporte
'lowmemory' => null,
};

return new MetricExporter(Registry::transportFactory($protocol)->create(
return new MetricExporter(Loader::transportFactory($protocol)->create(
endpoint: $properties['endpoint'] . OtlpUtil::path(Signals::METRICS, $protocol),
contentType: Protocols::contentType($protocol),
headers: $headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use OpenTelemetry\Config\SDK\Configuration\ComponentProvider;
use OpenTelemetry\Config\SDK\Configuration\ComponentProviderRegistry;
use OpenTelemetry\Config\SDK\Configuration\Context;
use OpenTelemetry\SDK\Registry;
use OpenTelemetry\SDK\Common\Services\Loader;
use OpenTelemetry\SDK\Trace\SpanExporter\ConsoleSpanExporter;
use OpenTelemetry\SDK\Trace\SpanExporterInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
Expand All @@ -23,7 +23,7 @@ final class SpanExporterConsole implements ComponentProvider
*/
public function createPlugin(array $properties, Context $context): SpanExporterInterface
{
return new ConsoleSpanExporter(Registry::transportFactory('stream')->create(
return new ConsoleSpanExporter(Loader::transportFactory('stream')->create(
endpoint: 'php://stdout',
contentType: 'application/json',
));
Expand Down
Loading
Loading