[incubator] ComposableProbabilitySampler does not validate ratio range
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- observability
Research direction
Start with ComposableSampler.probability(double) and ComposableProbabilitySampler.java in sdk-extensions/incubator, where the threshold is computed from ratio. Follow the value into CompositeSampler.isValidThreshold and OtelTraceState.serializeTh to confirm why out-of-range and NaN inputs silently fall back to always-off. Done means probability rejects ratio < 0.0, ratio > 1.0 and NaN with IllegalArgumentException, mirroring Sampler.traceIdRatioBased, covered by tests in the incubator sampler test sources.
Written by the indexing model from the issue text.
Description
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).
- 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
-
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
-
Feature Request
Difficulty 5/5 Over a week Newbie friendliness 12/100
open-telemetry/opentelemetry-java#9061 ·
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