Incompatibility with OkHttp 4.x since 1.52.0
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
从 reproducer 的 pom.xml 开始,运行 mvn install,以确认 okhttp 4.12.0 相对于 OpenTelemetry artifacts 的 requireUpperBoundDeps 失败。然后检查 opentelemetry-exporter-sender-okhttp、opentelemetry-sdk-extension-jaeger-remote-sampler 和 opentelemetry-bom 的 Maven 依赖声明;完成后应保留与 okhttp 4.x 的兼容性,并确定受影响 artifacts 的管理方式。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Java
- 星标
- 2.5k
- 派生
- 1.1k
- 平均合并
- 5 天 11 小时
- 30 天内合并 PR
- 41
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
open-telemetry/opentelemetry-java 的其他 Issue
-
`B3PropagatorExtractorMultipleHeaders` allocates when headers are missing可能已有人在做 @Eliot5566 今天认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 82/100
open-telemetry/opentelemetry-java#9065 ·
维护者通常 3 天内回复
-
[incubator] ComposableProbabilitySampler does not validate ratio range可能已有人在做 @eminfikret 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
open-telemetry/opentelemetry-java#9046 · 2 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
-
PrometheusComponentProvider promotes all resource attributes when resource_constant_labels is empty ({})可能已有人在做 @rooks-ns 于 19 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
open-telemetry/opentelemetry-java#9014 · 1 条评论 ·
维护者通常 3 天内回复
-
Fix `otel.sdk.log.created` counting semantics可能已有人在做 @anuraaga 于 112 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
open-telemetry/opentelemetry-java#8688 ·
维护者通常 3 天内回复
-
SdkSpanBuilder drops invalid parent TraceState when IdGenerator.generatesRandomTraceIds() is true可能已有人在做 @Eliot5566 今天认领。 未关闭Bug SDK
难度 4/5 3-5 天 新手友好度 48/100
open-telemetry/opentelemetry-java#9062 · 1 条评论 ·
维护者通常 3 天内回复
查看 open-telemetry/opentelemetry-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 79/100
micronaut-projects/micronaut-core#14585 ·
维护者通常 1 天内回复
-
Mend: dependency security vulnerability untriaged
难度 1/5 1 小时以内 新手友好度 78/100
opensearch-project/cross-cluster-replication#1805 ·
维护者通常 1 天内回复
-
feature request needs triage
难度 1/5 1 小时以内 新手友好度 66/100
TeamNewPipe/NewPipe#14083 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
PCL-Community/PCL-CE#3907 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 2 天内回复