未验证 提交 720c1dd9 编写于 作者: Z zifeihan 提交者: GitHub

Use traceId as the judgment condition for sampling trace. (#5386)

上级 77d94b4d
......@@ -126,7 +126,7 @@ public class SegmentAnalysisListener implements FirstAnalysisListener, EntryAnal
@Override
public void parseSegment(SegmentObject segmentObject) {
if (sampleStatus.equals(SAMPLE_STATUS.UNKNOWN) || sampleStatus.equals(SAMPLE_STATUS.IGNORE)) {
if (sampler.shouldSample(segmentObject.getTraceSegmentId())) {
if (sampler.shouldSample(segmentObject.getTraceId())) {
sampleStatus = SAMPLE_STATUS.SAMPLED;
} else {
sampleStatus = SAMPLE_STATUS.IGNORE;
......
......@@ -31,7 +31,7 @@ public class TraceSegmentSampler {
this.traceSampleRateWatcher = traceSampleRateWatcher;
}
public boolean shouldSample(String segmentId) {
return segmentId.hashCode() % 10000 < traceSampleRateWatcher.getSampleRate();
public boolean shouldSample(String traceId) {
return traceId.hashCode() % 10000 < traceSampleRateWatcher.getSampleRate();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册