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 c88deba commit 2bdbbd1
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 @@ -4,15 +4,18 @@

use OpenTelemetry\Extension\Propagator\Jaeger\JaegerBaggagePropagator;
use OpenTelemetry\Extension\Propagator\Jaeger\JaegerPropagator;
use OpenTelemetry\SDK\Common\Configuration\KnownValues;
use OpenTelemetry\SDK\Registry;

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

Registry::registerTextMapPropagator(
KnownValues::VALUE_JAEGER,
'jaeger',
JaegerPropagator::getInstance()
);

Registry::registerTextMapPropagator(
KnownValues::VALUE_JAEGER_BAGGAGE,
'jaeger-baggage',
JaegerBaggagePropagator::getInstance()
);

0 comments on commit 2bdbbd1

Please sign in to comment.