Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Is this file meant to be changed?

Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ protected <T extends CoreSpan<T>> long getSamplingId(T span) {

private static final double MAX = Math.pow(2, 64) - 1;

private final float rate;
private final double rate;
private final long threshold;

public DeterministicSampler(final double rate) {
this.rate = (float) rate;
this.rate = rate;
this.threshold = cutoff(rate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ void testSamplingAll(String traceId) {
assertTrue(sampler.sample(span));
}

@TableTest({"rate ", "0.123456789", "0.999999999"})
void preservesConfiguredSampleRate(double rate) {
assertEquals(rate, new DeterministicSampler.TraceSampler(rate).getSampleRate());
}

@ParameterizedTest(name = "rate={0}")
@MethodSource("testCutoffCalculationArguments")
void testCutoffCalculation(int rate) {
Expand Down