Incompatibility with OkHttp 4.x since 1.52.0
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, observability
Research direction
Start with the reproducer's pom.xml and run mvn install to confirm the requireUpperBoundDeps failure for okhttp 4.12.0 versus the OpenTelemetry artifacts. Then inspect the Maven dependency declarations for opentelemetry-exporter-sender-okhttp, opentelemetry-sdk-extension-jaeger-remote-sampler, and opentelemetry-bom; done should preserve okhttp 4.x compatibility and establish how the affected artifacts are managed.
Written by the indexing model from the issue text.
Description
Describe the bug
Since v1.52.0, opentelemetry-exporter-sender-okhttp and opentelemetry-sdk-extension-jaeger-remote-sampler started to depend on okhttp 5.x. If my application still needs depend on okhttp 4.x, I will not be able to upgrade to newer versions of opentelemetry.
Furthermore, if any of my dependencies (e.g. google-cloud-storage) upgraded any opentelemetry artifacts beyond 1.52.0, I will not be able to upgrade them as well if I use opentelemetry-bom 1.51.0. This is because both aforementioned artifacts are in the bom.
Steps to reproduce
Given the following pom configuration
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
<version>1.52.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-sender-okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<requireUpperBoundDeps>
</requireUpperBoundDeps>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
running mvn install would produce the following upper bound dependencies error
[ERROR] Require upper bound dependencies error for com.squareup.okhttp3:okhttp:4.12.0. Paths to dependency are:
[ERROR] +-org.example:testOtelOKHttp:1.0-SNAPSHOT
[ERROR] +-com.squareup.okhttp3:okhttp:4.12.0
[ERROR] and
[ERROR] +-org.example:testOtelOKHttp:1.0-SNAPSHOT
[ERROR] +-io.opentelemetry:opentelemetry-exporter-sender-okhttp:1.52.0
[ERROR] +-com.squareup.okhttp3:okhttp:5.1.0 [runtime]
What did you expect to see?
I can continue to use okhttp 4.x and opentelemetry 1.52.0+ without being forced to upgrade my application.
What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-sender-okhttp, opentelemetry-sdk-extension-jaeger-remote-sampler, opentelemetry-bom
Version: v1.52.0
How did you reference these artifacts? pom.xml
Environment
Compiler: Temurin-24.0.1
OS: MacOS 15.7.3
Workarounds
- Ignoring the enforcer errors and force okhttp version to 4.12.0. This could potentially work if
opentelemetry-exporter-sender-okhttpdoes not use any new features from 5.x, otherwise there could be runtime errors. However, even if it works, force downgrading major versions is risky and error prone. It would break if someone starts to use new features from 5.x accidentally. - Only downgrade
opentelemetry-exporter-sender-okhttpto 1.51.0, still use opentelemetry-bom 1.52.0 to manage other opentelemetry artifacts such asopentelemetry-api. However, this requires more work like downgrading versions of transitive dependencykotlin-stdlib-jdk8. Managing different versions of opentelemetry artifacts is also costly and error prone in large corps with thousands of repos.
Possible solutions
Downgrade okhttp to 4.12.0 to maintain backward compatibility. Only upgrade it to the next major version if needed.
In addition, consider removing exporters such as opentelemetry-exporter-sender-okhttp and opentelemetry-sdk-extension-jaeger-remote-sampler from opentelemetry-bom. The problem of them being included in the bom is that, if a third party library is only dependent on opentelemetry-api and upgraded it to the latest, it would force the users of the third party library to bump opentelemetry-bom and all transitive dependencies included in it. IMO, the opentelemetry-bom should only manage core libraries with minimum transitive dependencies. The exporters should follow a different version strategy as well.
Separately, regarding the general upgrading strategy of transitive dependencies. I think it's OK to keep them up to date if there are no breaking changes, since people can always upgrade them to latest if needed. However, for major version bump (okhttp 4.x to 5.x) that contains a lot of breaking changes, upgrading it should be very careful since users of opentelemetry would be forced to upgrade their codebase. Depending on the scenario, upgrading major versions of transitive dependencies may warrant a major version bump.
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1.1k
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 41
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from open-telemetry/opentelemetry-java
-
`B3PropagatorExtractorMultipleHeaders` allocates when headers are missingPossibly taken @Eliot5566 claimed this today. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-telemetry/opentelemetry-java#9065 ·
Maintainers usually reply within 3 days
-
[incubator] ComposableProbabilitySampler does not validate ratio rangePossibly taken @eminfikret claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#9046 · 2 comments · 1 assignee ·
Maintainers usually reply within 3 days
-
PrometheusComponentProvider promotes all resource attributes when resource_constant_labels is empty ({})Possibly taken @rooks-ns claimed this 19 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-java#9014 · 1 comment ·
Maintainers usually reply within 3 days
-
Fix `otel.sdk.log.created` counting semanticsPossibly taken @anuraaga claimed this 112 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#8688 ·
Maintainers usually reply within 3 days
-
SdkSpanBuilder drops invalid parent TraceState when IdGenerator.generatesRandomTraceIds() is truePossibly taken @Eliot5566 claimed this today. OpenBug SDK
Difficulty 4/5 3-5 days Newbie friendliness 48/100
open-telemetry/opentelemetry-java#9062 · 1 comment ·
Maintainers usually reply within 3 days
All issues in open-telemetry/opentelemetry-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
opensearch-project/cross-cluster-replication#1805 ·
Maintainers usually reply within 1 day
-
feature request needs triage
Difficulty 1/5 Under an hour Newbie friendliness 66/100
TeamNewPipe/NewPipe#14083 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
PCL-Community/PCL-CE#3907 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 2 days