Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: root span name in Slim V4 #3020

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link

@mrtus mrtus Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Can this be overwritten?

A lot of our notebooks & dashboarding are configured on web.request, so it would be a shame if everything needs to be updated again.

Kinda would consider this a breaking change, especially since also monitors and such probably rely on this value.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging @PROFeNoM and @bwoebi for visibility

Or if you require me to create an issue by all means I can do that :D

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can easily overwrite it with \DDTrace\root_span()->name = 'web.request'; at the end of your entrypoint for example.

$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
Loading