[incubator] ComposableProbabilitySampler does not validate ratio range
维护者通常 3 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
调研方向
从 sdk-extensions/incubator 中的 ComposableSampler.probability(double) 和 ComposableProbabilitySampler.java 开始,其中阈值由 ratio 计算得出。沿着该值进入 CompositeSampler.isValidThreshold 和 OtelTraceState.serializeTh,以确认为什么超出范围的输入和 NaN 会静默回退到 always-off。完成意味着 probability 会用 IllegalArgumentException 拒绝 ratio < 0.0、ratio > 1.0 和 NaN,与 Sampler.traceIdRatioBased 保持一致,并由 incubator sampler 测试源中的测试覆盖。
由索引模型根据 Issue 内容生成。
描述
Problem
During a cross-implementation audit against the OpenTelemetry probability sampling specification (open-telemetry/opentelemetry-specification#5440), ComposableProbabilitySampler.java and ComposableSampler.probability(double) do not validate ratio:
- Passing
ratio > 1.0(for example2.0) computesMAX_THRESHOLD - Math.round(ratio * MAX_THRESHOLD)<0, which failsisValidThresholdinCompositeSamplerand silently drops all spans (0%sampling) instead of rejecting invalid input or clamping to1.0. - Passing
ratio < 0.0computes a threshold >MAX_THRESHOLD, which silently failsisValidThreshold(dropping all spans) and wraps the high bits inOtelTraceState.serializeTh(producing a misleadingthreshold=...ingetDescription(), e.g.,threshold=8forratio = -0.5). - Passing
Double.NaNevaluatesMath.round(NaN) == 0, silently producingMAX_THRESHOLD(always off) with no error.
Expected Behavior
Validate ratio in ComposableSampler.probability(double) / ComposableProbabilitySampler (throwing IllegalArgumentException when ratio < 0.0 || ratio > 1.0 || Double.isNaN(ratio), extending Sampler.traceIdRatioBased's [0.0, 1.0] check to also reject NaN).
- 主要语言
- 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 天内回复
-
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 天内回复
-
Feature Request
难度 5/5 一周以上 新手友好度 12/100
open-telemetry/opentelemetry-java#9061 ·
维护者通常 3 天内回复
查看 open-telemetry/opentelemetry-java 的全部 Issue
相似的 Issue
-
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 天内回复
-
area/dependencies area/dependencies/quarkus backport/26.6 backport/26.8 kind/cve severity/critical source/scan-dependencies status/triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
stripe/stripe-java#2341 ·
维护者通常 3 天内回复