What is the expected behavior?
The instrumentation honours the semantic conventions for error spans: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
According to the otel semantic conventions, for 4xx status, the span status MUST be left unset for spans with SpanKind.SERVER.
What is the actual behavior?
For any error a stack trace and span status of error is sent.
Additional context
In Symfony applications, all errors are treated as exceptions, no matter if they are a 404 Not Found error or a fatal error triggered by throwing some exception in your code.
If a handled request contains an exception, the auto instrumentation adds the exception to the span and sets the span kind to error. (L107L163).
The span status can be left unset if the response status code is in the 4xx range, as SymfonyInstrumentation.php only handles requests with SpanKind of server and internal.
What is the expected behavior? The instrumentation honours the semantic conventions for error spans: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status According to the otel semantic conventions, for 4xx status, the span status MUST be left unset for spans with SpanKind.SERVER.
What is the actual behavior? For any error a stack trace and span status of error is sent.
Additional context In Symfony applications, all errors are treated as exceptions, no matter if they are a 404 Not Found error or a fatal error triggered by throwing some exception in your code. If a handled request contains an exception, the auto instrumentation adds the exception to the span and sets the span kind to error. (L107 L163). The span status can be left unset if the response status code is in the 4xx range, as SymfonyInstrumentation.php only handles requests with SpanKind of server and internal.