-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
Hello,
The original issue we were facing was described in this discussion. In short, we cannot use okhttp as metrics sender because of lack of support on Proxy-Authorization header.
What we were trying to workaround this issue is by using JDK http client based sender instead. This should have worked because we saw this implementation in place. However, it's not working correctly with the java agent version.
I inspected what's on the classpath of the built agent jar, and noticed that opentelemetry-exporter-sender-jdk is actually not packaged. This might be a bug? I tested locally, after adding this line to the javaagent-tooling/build.gradle.kts file, the agent starts to allow choosing between 2 implementations:

More concretely, this would happen with the fix:
- If nothing is specified, the warning will be logged and okhttp will be picked by default:
-
If we run the application with this arg
-Dio.opentelemetry.exporter.internal.http.HttpSenderProvider=io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSenderProvider, there is no more warning and it uses okhttp as sender. -
If we run the application with this arg
-Dio.opentelemetry.exporter.internal.http.HttpSenderProvider=io.opentelemetry.exporter.sender.jdk.internal.JdkHttpSenderProvider, there is no warning either and it uses JDK http client as sender.
Correct me if I am wrong, I believe this is the expected behaviour?
Thanks a lot in advance for your insights 🙏
Steps to reproduce
Run a jar with args: -javaagent:opentelemetry-javaagent.jar -Dotel.metrics.exporter=otlp -Dio.opentelemetry.exporter.internal.http.HttpSenderProvider=io.opentelemetry.exporter.sender.jdk.internal.JdkHttpSenderProvider ...
Expected behavior
We should see JDK http client doing the metrics sending.
Actual behavior
We see it's still the okhttp client doing the metrics sending.
Javaagent or library instrumentation version
any version (I built a fresh version from main branch)
Environment
(Irrelevant)
JDK:
openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)
OS:
MacOS 15.5 (24F74)
Additional context
No response