Use traceId as the judgment condition for sampling trace. (#5386)
This commit is contained in:
parent
77d94b4d2a
commit
720c1dd92f
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue