Describe your environment
- PHP version: 8.4
- open-telemetry/opentelemetry-auto-symfony: ^1.1.1
- Symfony: 8
- OS: Linux
Steps to reproduce
- Create a Symfony application with a route that has path parameters:
<?php
#[Route('/v1/payments/{paymentId}/capture', name: 'api_payments_capture', methods: ['POST'])]
public function capture(string $paymentId): Response
{
return new JsonResponse(['id' => $paymentId]);
}
- Make a request to POST /v1/payments/abc123/capture
- Inspect the generated span in your tracing backend (Jaeger, etc.) in http.route will be "api_payments_capture"
What is the expected behavior?
Per OpenTelemetry HTTP semantic conventions, http.route should be "the matched route template for the request. This MUST be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders"
- http.route: /v1/payments/{paymentId}/capture
What is the actual behavior?
The instrumentation uses the Symfony route name from $request->attributes->get('_route'):
- http.route: api_payments_capture
Additional context
Current workaround is to use an event subscriber that modifies _route before the instrumentation reads it, but this is fragile and could affect other application logic that depends on the route name.
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.