-
Notifications
You must be signed in to change notification settings - Fork 849
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
Should we provide jdk11 version of OTLP http exporters? #5351
Comments
A common way to handle this is to define an interface, have various implementations implement it, and then load an implementation using ServiceLoader. This is explicitly supported by the module system ( At a very high level, you'd have something like: A module
Then a module
The OLTP implementation then declares a dependency solely on |
The nice thing about using services is that it makes the dependency explicit whilst also leaving users free to pick which dependency they want. The service declarations are also recognized by GraalVM and |
This is also assuming that you actually want to continue to have multiple http client implementations. I'm not sure if that was determined or not. |
@io7m there are retry requirements and the need to use a provided serializer |
I can't speak to the actual implementation of the client as I don't know the OLTP codebase well enough. I just wanted to explain that there's a fairly standard way to deliver something like this (where you have users picking between optional dependencies) that's supported by the module system. That was question 2 on the list above. 🙂 |
After further consideration I think the best approach will be to create multiple http sender artifacts, one for okhttp and one for jdk http client, and require that one be present in order to use the OTLP http exporters. The implementation of this is more clear than the multi version jar approach, and means that users are including / excluding opentelemetry artifacts in order to achieve the desired behavior rather than okhttp dependencies. I propose we:
We can decide whether
The otel java agent would add a dependency on the As mentioned in the java sig, we suspect the majority of SDK users would add a dependency on
I'm working on implementing this plan locally and will deliver it incrementally to make review more manageable. Please let me know if you have strong feelings against this approach. |
What is the lifetime of java8? Since OkHTTP and other major libraries dropped support for java8 have you considered to do the same? |
Removing java 8 support would mean removing java 8 support for the otel java agent, which would be extremely unpopular given that the java agent is popular among legacy apps. |
OkHttp still supports Java 8 though. Android still uses Java 8 level APIs, and I'm not sure whether that's likely to change -- probably not, Kotlin's supposed to bridge that gap. If we drop Java 8 we might run into issues with Android support. |
I added a comment on the PR because I think we should consider only allowing one HttpSender, to avoid mistakes. |
I think this is a great way to embrace the newer versions of the JDK. It makes me wonder, is there a plan to do JDK version of |
We would love to but the JDK HttpClient doesn't support trailing headers, which are required for gRPC 😞 |
I did not know that, very interesting, thanks! |
Related issues: #4777
@brunobat brings up in CNCF slack that OkHttp is problematic because older versions may have unpatched CVEs, while newer versions have a dependency on kotlin stdlib.
In #5341 I've prototyped an approach where we publish a multi-release jar where in which the java11+ version uses the jdk 11+ Http Client. After some initial concerns about performance, I've been able to iron out much of the problem by replacing some of the default implementation of
BodyPublisher
.But additional work is needed to get the prototype in a place to merge.
Before I do that work, I want to answer a few key questions:
a. One option is to do the multi-release jar prototyped in Promote log API / SDK to stable #5341. Users would need to explicitly exclude the okhttp dependency using gradle exclude syntax.
b. Another option is to provide dedicated "sender" or "tranasport" artifacts representing the different implementations. I.e. publish new
opentelemetry-exporter-jdk-http-sender
andopentelemetry-exporter-okhttp-sender
. We could then include the okhttp sender as a default dependency ofopentelemetry-exporter-otlp
. Or we could force users to choose one, and document that when you addopentelemetry-exporter-otlp
, you must also add aopentelemetry-exporter-*-sender
.Want to gather feedback before I go any further working on this. I think the #5341 prototype makes it clear that its possible and reasonable to have a zero dependency otlp http exporter. Now we need to decide whether we to deliver and maintain that.
The text was updated successfully, but these errors were encountered: