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

HTTP response attributes are missing from OpenTelemetry client span when HttpClientResponseException is thrown #709

Open
lgathy opened this issue Feb 17, 2025 · 0 comments · May be fixed by #710

Comments

@lgathy
Copy link
Contributor

lgathy commented Feb 17, 2025

Expected Behavior

OpenTelemetry client http span should contain the status_code attribute when an error response is returned.

Actual Behaviour

When either the low-level or the declarative Micronaut HTTP client call ends with an HttpClientResponseException, the client span will not contain any attributes derived from the HttpResponse, i.e. status code, content length, captured response headers or the error.type.

This happens because OpenTelemetryClientFilter passes null as response to the OpenTelemetry instrumenter when an exception was caught, even though the response object might be inside that exception in certain cases (HttpClientResponseException). In this case OpenTelemetry never sees the HttpResponse instance, thus cannot extract attributes from it.

Steps To Reproduce

Run the test added in this commit: lgathy@8a6b7db

Environment Information

  • Operating System: Debian 12
  • JDK Version: OpenJDK 17.0.14

Example Application

No response

Version

Micronaut Tracing 6.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant