Skip to content

Commit 38b461b

Browse files
committed
Removed Opentelemetry class
1 parent 0ab11e2 commit 38b461b

File tree

3 files changed

+8
-69
lines changed

3 files changed

+8
-69
lines changed

src/Instrumentation/PDO/src/Opentelemetry.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Instrumentation/PDO/src/PDOInstrumentation.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace OpenTelemetry\Contrib\Instrumentation\PDO;
66

77
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
8+
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
89
use OpenTelemetry\API\Trace\Span;
910
use OpenTelemetry\API\Trace\SpanBuilderInterface;
1011
use OpenTelemetry\API\Trace\SpanKind;
@@ -416,10 +417,14 @@ private static function addSqlComments(string $query, bool $withTraceContext): s
416417
{
417418
$comments = [];
418419
if ($withTraceContext) {
419-
$comments = Opentelemetry::getTraceContextValues();
420+
$prop = TraceContextPropagator::getInstance();
421+
$prop->inject($comments);
420422
}
421-
foreach (Opentelemetry::getServiceNameValues() as $key => $value) {
422-
$comments[$key] = $value;
423+
if (class_exists('OpenTelemetry\Contrib\Propagation\ServiceName\ServiceNamePropagator')) {
424+
/** @phan-suppress-next-line PhanUndeclaredClassMethod */
425+
$prop = new \OpenTelemetry\Contrib\Propagation\ServiceName\ServiceNamePropagator();
426+
/** @phan-suppress-next-line PhanAccessMethodInternal,PhanUndeclaredClassMethod */
427+
$prop->inject($comments);
423428
}
424429
$query = trim($query);
425430
if (self::isSqlCommenterPrepend()) {

src/Instrumentation/PDO/tests/Unit/OpentelemetryTest.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)