-
Notifications
You must be signed in to change notification settings - Fork 130
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
Replace SimpleHttpClient (okhttp based) by JdkHttpClient (HttpURLConnection based) #1061
base: main
Are you sure you want to change the base?
Conversation
check out open-telemetry/opentelemetry-java#3991, in particular:
cc @LikeTheSalad who is investigating options for suppress tracing of specific calls |
+1 on eliminating this dependency for this specific case |
there's work in-progress which could unblock this: open-telemetry/opentelemetry-java#5918 |
I think that's to avoid having the call traced, whereas this PR is about removing the okhttp dependency completely for this specific resource? |
the reverse of this PR (moving from HttpURLConnection to OkHttp) was done a while ago in open-telemetry/opentelemetry-java#3991 (when this code lived in that repository) I think really it's only a problem for the AWS distribution of the OTel Java agent, since that distribution pulls this component in, while the upstream Java agent doesn't (yet). The reason why OkHttp calls aren't traced in the Java agent is because OkHttp is loaded in the agent class loader, and instrumentation isn't applied in that class loader. While HttpURLConnection is loaded in the bootstrap class loader and so instrumentation is applied. |
Another aspect that might be relevant to deal with once this PR is merged is providing the ability to reuse the |
Is there anything else preventing the PR from being merged? The above mentioned change was already merged... |
@rjbaucells can you integrate that change into your PR? |
I looked at the details of PR 5918 and it provides a way to supress instrumentation of internal calls in "exporters" via setting the Looking at the implementation of the JDK (11+) based sender, it is not suppressing the instrumentation of the requests; only the okHttp sender implementation is using it. I would assume the java agent will process calls to the JDK HttpClient the same way as the HttpURLConnection. Do we really need to suppress these calls for the HttpURLConnection? |
right, so the okhttp sender is using it so that auto-instrumentation of OkHTTP won't capture those http requests in the same way, I think the code here could use it so that auto-instrumentation of HttpURLConnection won't capture these http requests |
The Context value in the above mentioned PR is Is there a generic Context value I can set prior to the HTTP call that will instruct the agent to skip the instrumentation? |
any ETA on this one ? |
The open-telemetry/opentelemetry-java#6546 PR was just merged and will be available with 1.41.0 SDK release, so the issue about using an exporter-related context entry (here) is solved. The logical next steps are thus:
This of course assumes that @rjbaucells has time to dedicate to this, let us know if you need any help here. |
When is SDK 1.41.0 expected to be released? |
I don't know if there is an official release schedule, but looking at past releases hint that we have roughly one release per month: https://github.com/open-telemetry/opentelemetry-java/releases, so it would likely be available within 2/3 weeks. |
I have the PR already updated, waiting for SDK 1.41.0 to push it. |
check out https://github.com/open-telemetry/opentelemetry-java/blob/main/RELEASING.md#release-cadence, so Aug release target is Fri, Aug 9 |
Rebase it! |
@driverpt if I'm not mistaken the |
Oh. I was not aware of that. Apologies then. Do you know +/- an ETA for this to be "releaseable"? Thanks |
I think this can move forward now using the new internal API that was introduced in open-telemetry/opentelemetry-java#6546 |
Description:
Replaced existing
okhttp
based HttpClient (SimpleHttpClient
) by a JDK 1.8 implementation usingHttpURLConnection
.okhttp
adds too many dependencies to a project that performs simple HTTP calls to discover resource metadata in AWS ECS and EKS. The AWS endpoints supports HTTP/1.1 and there is no need to higher protocol version (HTTP/2).See the
okhttp
dependency tree in a Java project:Is is well known that having
okhttp
as a dependency makes very difficult (or impossible) to create a Graal native image of a consuming application.Also,
okio
has known vulnerabilitiesOpenTelemetry OTLP exporter supports excluding
okhttp
based implementation in favor of a JDK-11 implementation via ServiceManager. I do not think the same solution is needed here since the HTTP client requirements for this project are very simple and not a high throughput implementation is required for a single HTTP request in the application lifespan.Initial PR does not remove the
okhttp
implementation nor the dependency (made optional). An update is required before merging it to completely removeokhttp
.