-
Notifications
You must be signed in to change notification settings - Fork 867
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
Guard against null HttpContext #6792
Guard against null HttpContext #6792
Conversation
#6791 should address the test failure. |
...ry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientInstrumentation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this is the best approach. Considering that if the passed HttpContext
is null a blank one will be created a few calls deeper we might as well create it here. This would avoid loosing the telemetry that requires access to response.
I will never assert that any change I have ever or will ever make will be the "best".
I'm not following this. Where does a blank |
See https://github.com/apache/httpcomponents-client/blob/7ab435c271b6ff3bde4e737c2b02ba873ffa8b55/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java#L177 for where http client handles null context. Try adding null context to Line 91 in da3eecf
Line 96 in da3eecf
http.status_code and http.flavor are not filled because they are extracted from the response. Change Line 70 in da3eecf
@Advice.Argument(value = 3, readOnly = false) HttpContext httpContext and add
|
Ok, I think I see where you're coming from. The fact that the client defaults the null
It's feeling like one of the changes (either test code or instrumentation) is a semantic change. I'm not sure which it is....but explicitly passing in a null context caused the tests to fail before this change and with this change. If you feel strongly about the null guard being a bad solution, I can close this. |
@breedx-splk did you maybe miss making the
|
🤦🏻 yes...that was it. Thanks. I'll push a change. |
165d770
to
882875a
Compare
@breedx-splk can you rebase? github UI appears to be lying about your change set (at least to me), I've seen this a couple of times recently and rebasing to latest |
882875a
to
7cf172e
Compare
...ry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientInstrumentation.java
Outdated
Show resolved
Hide resolved
…ent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientInstrumentation.java
Resolves open-telemetry#6787 Co-authored-by: Trask Stalnaker <[email protected]>
Resolves open-telemetry#6787 Co-authored-by: Trask Stalnaker <[email protected]>
Resolves open-telemetry#6787 Co-authored-by: Trask Stalnaker <[email protected]>
Resolves #6787