File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
dd-trace-core/src/main/java/datadog/trace/common/sampling Expand file tree Collapse file tree 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) {
3939 private static final double MAX = Math .pow (2 , 64 ) - 1 ;
4040
4141 private final float rate ;
42+ private final long threshold ;
4243
4344 public DeterministicSampler (final double rate ) {
4445 this .rate = (float ) rate ;
46+ this .threshold = cutoff (rate );
4547 }
4648
4749 @ Override
4850 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 ;
5153 }
5254
5355 protected abstract <T extends CoreSpan <T >> long getSamplingId (T span );
You can’t perform that action at this time.
0 commit comments