diff --git a/src/Instrumentation/Symfony/src/SymfonyInstrumentation.php b/src/Instrumentation/Symfony/src/SymfonyInstrumentation.php index 06022a77..ea0238ff 100644 --- a/src/Instrumentation/Symfony/src/SymfonyInstrumentation.php +++ b/src/Instrumentation/Symfony/src/SymfonyInstrumentation.php @@ -83,7 +83,10 @@ public static function register(): void $routeName = $request->attributes->get('_route', ''); if ('' !== $routeName) { - $span->setAttribute(TraceAttributes::HTTP_ROUTE, $routeName); + /** @psalm-suppress ArgumentTypeCoercion */ + $span + ->updateName(sprintf('%s %s', $request->getMethod(), $routeName)) + ->setAttribute(TraceAttributes::HTTP_ROUTE, $routeName); } } diff --git a/src/Instrumentation/Symfony/tests/Integration/SymfonyInstrumentationTest.php b/src/Instrumentation/Symfony/tests/Integration/SymfonyInstrumentationTest.php index ad6dc1ce..97df64d4 100644 --- a/src/Instrumentation/Symfony/tests/Integration/SymfonyInstrumentationTest.php +++ b/src/Instrumentation/Symfony/tests/Integration/SymfonyInstrumentationTest.php @@ -48,7 +48,7 @@ public function test_http_kernel_handle_attributes(): void $attributes = $this->storage[0]->getAttributes(); $this->assertCount(1, $this->storage); - $this->assertEquals('HTTP GET', $this->storage[0]->getName()); + $this->assertEquals('GET test_route', $this->storage[0]->getName()); $this->assertEquals('http://:/', $attributes->get(TraceAttributes::URL_FULL)); $this->assertEquals('GET', $attributes->get(TraceAttributes::HTTP_REQUEST_METHOD)); $this->assertEquals('http', $attributes->get(TraceAttributes::URL_SCHEME));