提交 fa81a0f6 编写于 作者: wu-sheng's avatar wu-sheng

Check sampling mechanism.

上级 680c2c23
......@@ -40,6 +40,7 @@ public class SamplingService implements BootService {
if (on) {
if (rollingSeed % Config.Agent.SAMPLING_CYCLE != 0) {
segment.setSampled(false);
this.rollingSeed = 1;
}
rollingSeed++;
}
......
......@@ -5,6 +5,7 @@ import com.a.eye.skywalking.trace.TraceId.DistributedTraceId;
import com.a.eye.skywalking.trace.TraceId.PropagatedTraceId;
import com.a.eye.skywalking.trace.TraceSegment;
import com.a.eye.skywalking.trace.tag.Tags;
import java.awt.SystemTray;
import java.util.LinkedList;
import java.util.List;
import org.junit.After;
......
......@@ -26,6 +26,10 @@ public class SamplingServiceTest {
segment = new TraceSegment();
service.trySampling(segment);
Assert.assertTrue(segment.isSampled());
segment = new TraceSegment();
service.trySampling(segment);
Assert.assertFalse(segment.isSampled());
}
@AfterClass
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册