open-telemetry / open-telemetry/opentelemetry-java-contrib
Consistent sampling tests are flaky
Open
@PeterF778 is already working on this.
Since Jul 23, 2025.
bug
component:consistent-sampling
- Dominant language
- Java
- Stars
- 269
- Forks
- 196
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 38
Description
Component(s)
consistent-sampling
What happened?
https://scans.gradle.com/s/lkud6oenfjrhi
https://scans.gradle.com/s/2xvjyd25fvjng
Seems to be fairly easy to reproduce, change @Test to @RepeatedTest(100).
added
System.err.println(originalNumberOfSpans + " " + observedPvalues + " " + samplingProbability);
System.err.println(expectedProbabilities + " " + Arrays.toString(observedValues));
to https://github.com/open-telemetry/opentelemetry-java-contrib/blob/d18102b7ba05be4ade560b9c3cd8ebb736220f1c/consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent/ConsistentProbabilityBasedSamplerTest.java#L143
for failing test it printed out
1000000 {4=37074, 5=12751} 0.05
{4=0.037500000000000006, 5=0.012499999999999997, NOT SAMPLED=0.95} [37074, 12751, 950175]
Component version
1.48.0
Log output
No response
Additional context
No response
Contributor 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.
Assessment
This issue has not been assessed yet.