Remove JAXRS HttpClient instrumentations #5430
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Jersey, CXF and RESTEasy http client instrumentations are producing duplicate CLIENT spans currently, because they use HttpURLConnection by default (which looks pluggable at least in some cases).
(btw another reason for #5261 (comment))
The standard solution of course is to make the client spans created by these instrumentations "active" before they delegate to underlying http client library.
This is surprisingly difficult because of the layer at which this instrumentation is written.
The instrumentation is written as a JAX-RS
ClientRequestFilter
andClientResponseFilter
, I suspect in order to get access to the underlying HTTP url and response code, which aren't readily available at the JAXRS layer.But this makes things hard already because the
ClientResponseFilter
doesn't get called for exceptions (and thus the various and slightly odd JAXRS implementation-specific instrumentations).And it makes it hard to propagate context because it's not clear to me that these two filters will be called in the same thread (e.g. JAXRS supports async http client calls returning
Future
).But then I am really wondering what's the value of these JAXRS client spans over the underlying http client spans.
If the JAXRS client were captured at the top level where the application code interacted with it, I would see value. But as it is, the spans are captured in between where the application code interacts with it and the underlying http client, which seems to have very limited value.
Maybe we should capture these JAXRS spans where the application code interacts with it (e.g.
javax.ws.rs.client.AsyncInvoker
) and capture them as INTERNAL spans with their own convention. I think this could parallel the hibernate instrumentation, since they are both "object" interfaces on top of underlying http/sql.But I'm not personally convinced that these INTERNAL spans would have a lot of value (similar to my opinion about the hibernate INTERNAL spans), so I'm proposing we just delete this instrumentation (but keep the tests, which still pass!) and wait for more user feedback to justify value in capturing INTERNAL spans.
EDIT on third thought, I'm sort of not sure what the point of keeping only the tests is, although they did uncover a bug in the HttpURLConnection instrumentation, and they are already written....