Fixed percentage value in percentage based sampler

fixes #608
This commit is contained in:
Marcin Grzejszczak
2017-06-06 07:54:17 +02:00
parent 215577a31c
commit 6a0a57ef7f

View File

@@ -1,12 +1,12 @@
package org.springframework.cloud.sleuth.sampler;
import org.springframework.cloud.sleuth.Sampler;
import org.springframework.cloud.sleuth.Span;
import java.util.BitSet;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.cloud.sleuth.Sampler;
import org.springframework.cloud.sleuth.Span;
/**
* This sampler is appropriate for low-traffic instrumentation (ex servers that each receive <100K
* requests), or those who do not provision random trace ids. It not appropriate for collectors as
@@ -39,7 +39,7 @@ public class PercentageBasedSampler implements Sampler {
public boolean isSampled(Span currentSpan) {
if (this.configuration.getPercentage() == 0 || currentSpan == null) {
return false;
} else if (this.configuration.getPercentage() == 100) {
} else if (this.configuration.getPercentage() == 1.0f) {
return true;
}
synchronized (this) {