Skip to content

Commit

Permalink
Prevent propagator packages from throwing fatal error if sdk not inst…
Browse files Browse the repository at this point in the history
…alled (#1198)

* Prevent propagator extensions from failing if sdk not installed

* Remove KnownValues dependency

Also prevents failing for cloudtrace: sdk < 1.0.1 and jaeger: sdk < 1.0.3.
  • Loading branch information
Nevay authored Dec 24, 2023
1 parent aeb4151 commit 71b58eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions _register.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
declare(strict_types=1);

use OpenTelemetry\Extension\Propagator\B3\B3Propagator;
use OpenTelemetry\SDK\Common\Configuration\KnownValues;
use OpenTelemetry\SDK\Registry;

if (!class_exists(Registry::class)) {
return;
}

Registry::registerTextMapPropagator(
KnownValues::VALUE_B3,
'b3',
B3Propagator::getB3SingleHeaderInstance()
);
Registry::registerTextMapPropagator(
KnownValues::VALUE_B3_MULTI,
'b3multi',
B3Propagator::getB3MultiHeaderInstance()
);

0 comments on commit 71b58eb

Please sign in to comment.