Skip to content

Commit 7d37019

Browse files
authored
fix: root span name in Slim V4 (#3020)
1 parent cc11b8e commit 7d37019

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/DDTrace/Integrations/Slim/SlimIntegration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function ($app) use ($integration, $appName) {
3434
// Overwrite root span info
3535
$rootSpan = \DDTrace\root_span();
3636
$integration->addTraceAnalyticsIfEnabled($rootSpan);
37+
$rootSpan->name = 'slim.request';
3738
$rootSpan->service = $appName;
3839
$rootSpan->meta[Tag::SPAN_KIND] = 'server';
3940
$rootSpan->meta[Tag::COMPONENT] = SlimIntegration::NAME;
@@ -70,8 +71,6 @@ function ($errorMiddleware, $self, $args) use ($rootSpan, $integration) {
7071
}
7172

7273
if ('3' === $majorVersion) {
73-
$rootSpan->name = 'slim.request';
74-
7574
// Hook into the router to extract the proper route name
7675
\DDTrace\hook_method(
7776
'Slim\\Router',

tests/Integrations/Slim/V4/CommonScenariosTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function provideSpecs()
104104
[
105105
'A simple GET request returning a string' => [
106106
SpanAssertion::build(
107-
'web.request',
107+
'slim.request',
108108
'slim_test_app',
109109
'web',
110110
'GET /simple'
@@ -133,7 +133,7 @@ public function provideSpecs()
133133
],
134134
'A simple GET request with a view' => [
135135
SpanAssertion::build(
136-
'web.request',
136+
'slim.request',
137137
'slim_test_app',
138138
'web',
139139
'GET /simple_view'
@@ -170,7 +170,7 @@ public function provideSpecs()
170170
],
171171
'A GET request with an exception' => [
172172
SpanAssertion::build(
173-
'web.request',
173+
'slim.request',
174174
'slim_test_app',
175175
'web',
176176
'GET /error'
@@ -204,7 +204,7 @@ public function provideSpecs()
204204
],
205205
'A GET request to a route with a parameter' => [
206206
SpanAssertion::build(
207-
'web.request',
207+
'slim.request',
208208
'slim_test_app',
209209
'web',
210210
'GET /parameterized/paramValue'

0 commit comments

Comments
 (0)