File tree 1 file changed +4
-2
lines changed
dd-trace-core/src/main/java/datadog/trace/common/sampling
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,17 @@ protected <T extends CoreSpan<T>> long getSamplingId(T span) {
39
39
private static final double MAX = Math .pow (2 , 64 ) - 1 ;
40
40
41
41
private final float rate ;
42
+ private final long threshold ;
42
43
43
44
public DeterministicSampler (final double rate ) {
44
45
this .rate = (float ) rate ;
46
+ this .threshold = cutoff (rate );
45
47
}
46
48
47
49
@ Override
48
50
public <T extends CoreSpan <T >> boolean sample (final T span ) {
49
- // unsigned 64 bit comparison with cutoff
50
- return getSamplingId (span ) * KNUTH_FACTOR + Long .MIN_VALUE < cutoff ( rate ) ;
51
+ // unsigned 64 bit comparison with cutoff/threshold
52
+ return getSamplingId (span ) * KNUTH_FACTOR + Long .MIN_VALUE < threshold ;
51
53
}
52
54
53
55
protected abstract <T extends CoreSpan <T >> long getSamplingId (T span );
You can’t perform that action at this time.
0 commit comments