Skip to content

Commit

Permalink
fix: root span name in Slim V4 (#3020)
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM authored Jan 7, 2025
1 parent cc11b8e commit 7d37019
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/DDTrace/Integrations/Slim/SlimIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function ($app) use ($integration, $appName) {
// Overwrite root span info
$rootSpan = \DDTrace\root_span();
$integration->addTraceAnalyticsIfEnabled($rootSpan);
$rootSpan->name = 'slim.request';
$rootSpan->service = $appName;
$rootSpan->meta[Tag::SPAN_KIND] = 'server';
$rootSpan->meta[Tag::COMPONENT] = SlimIntegration::NAME;
Expand Down Expand Up @@ -70,8 +71,6 @@ function ($errorMiddleware, $self, $args) use ($rootSpan, $integration) {
}

if ('3' === $majorVersion) {
$rootSpan->name = 'slim.request';

// Hook into the router to extract the proper route name
\DDTrace\hook_method(
'Slim\\Router',
Expand Down
8 changes: 4 additions & 4 deletions tests/Integrations/Slim/V4/CommonScenariosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function provideSpecs()
[
'A simple GET request returning a string' => [
SpanAssertion::build(
'web.request',
'slim.request',
'slim_test_app',
'web',
'GET /simple'
Expand Down Expand Up @@ -133,7 +133,7 @@ public function provideSpecs()
],
'A simple GET request with a view' => [
SpanAssertion::build(
'web.request',
'slim.request',
'slim_test_app',
'web',
'GET /simple_view'
Expand Down Expand Up @@ -170,7 +170,7 @@ public function provideSpecs()
],
'A GET request with an exception' => [
SpanAssertion::build(
'web.request',
'slim.request',
'slim_test_app',
'web',
'GET /error'
Expand Down Expand Up @@ -204,7 +204,7 @@ public function provideSpecs()
],
'A GET request to a route with a parameter' => [
SpanAssertion::build(
'web.request',
'slim.request',
'slim_test_app',
'web',
'GET /parameterized/paramValue'
Expand Down

0 comments on commit 7d37019

Please sign in to comment.