Skip to content

Commit 2dd1774

Browse files
authored
Update trace sampling formula (#8734)
1 parent 4d01d58 commit 2dd1774

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

dd-trace-core/src/main/java/datadog/trace/common/sampling/DeterministicSampler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public DeterministicSampler(final double rate) {
4949
@Override
5050
public <T extends CoreSpan<T>> boolean sample(final T span) {
5151
// unsigned 64 bit comparison with cutoff/threshold
52-
return getSamplingId(span) * KNUTH_FACTOR + Long.MIN_VALUE < threshold;
52+
return getSamplingId(span) * KNUTH_FACTOR + Long.MIN_VALUE <= threshold;
5353
}
5454

5555
protected abstract <T extends CoreSpan<T>> long getSamplingId(T span);

dd-trace-core/src/test/groovy/datadog/trace/common/sampling/DeterministicTraceSamplerTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class DeterministicTraceSamplerTest extends DDSpecification {
121121
true | "9828766684487745566"
122122
true | "9908585559158765387"
123123
true | "9956202364908137547"
124+
true | "9223372036854775808"
124125
}
125126

126127
def "test sampling none: #traceId"() {

0 commit comments

Comments
 (0)