Skip to content

Commit f99df7a

Browse files
committed
Add region to span attributes and remove root span
1 parent 0262b34 commit f99df7a

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface;
88
use OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait;
9-
use OpenTelemetry\API\Trace\SpanInterface;
109
use OpenTelemetry\API\Trace\SpanKind;
1110
use OpenTelemetry\API\Trace\TracerInterface;
1211
use OpenTelemetry\API\Trace\TracerProviderInterface;
@@ -24,7 +23,6 @@ class AwsSdkInstrumentation implements InstrumentationInterface
2423
public const SPAN_KIND = SpanKind::KIND_CLIENT;
2524
private TextMapPropagatorInterface $propagator;
2625
private TracerProviderInterface $tracerProvider;
27-
private SpanInterface $root;
2826

2927
public function getName(): string
3028
{
@@ -71,22 +69,11 @@ public function getTracer(): TracerInterface
7169
return $this->tracerProvider->getTracer('io.opentelemetry.contrib.php');
7270
}
7371

74-
public function endRootSpan($rootScope)
75-
{
76-
$rootScope->detach();
77-
$this->root->end();
78-
}
79-
8072
public function activate(): bool
8173
{
8274
AwsGlobal::setInstrumentation($this);
8375

8476
try {
85-
$this->root = $this->getTracer()->spanBuilder('AwsSDKInstrumentation')->setSpanKind(SpanKind::KIND_CLIENT)->startSpan();
86-
$rootScope = $this->root->activate();
87-
88-
register_shutdown_function([$this, 'endRootSpan'], $rootScope);
89-
9077
runkit7_method_copy('Aws\AwsClient', '__call_copy', 'Aws\AwsClient', '__call');
9178
runkit7_method_copy('Aws\AwsClient', 'executeAsync_copy', 'Aws\AwsClient', 'executeAsync');
9279

@@ -109,6 +96,7 @@ public function activate(): bool
10996
"rpc.method" => $name,
11097
"rpc.service" => $this->getApi()->getServiceName(),
11198
"rpc.system" => "aws-api",
99+
"aws.region" => $this->getRegion()
112100
]);
113101
114102
return $this->__call_copy($name, $args);

0 commit comments

Comments
 (0)