Do not set the sampler rate for RateByServiceSampler
This commit is contained in:
parent
bd57b05537
commit
2dfc3ed465
|
@ -2,7 +2,6 @@ package datadog.trace.common.sampling;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import datadog.opentracing.DDSpan;
|
import datadog.opentracing.DDSpan;
|
||||||
import datadog.opentracing.DDSpanContext;
|
|
||||||
import datadog.trace.api.sampling.PrioritySampling;
|
import datadog.trace.api.sampling.PrioritySampling;
|
||||||
import datadog.trace.common.writer.DDApi.ResponseListener;
|
import datadog.trace.common.writer.DDApi.ResponseListener;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -58,7 +57,6 @@ public class RateByServiceSampler implements Sampler, ResponseListener {
|
||||||
} else {
|
} else {
|
||||||
span.setSamplingPriority(PrioritySampling.SAMPLER_DROP);
|
span.setSamplingPriority(PrioritySampling.SAMPLER_DROP);
|
||||||
}
|
}
|
||||||
span.context().setMetric(DDSpanContext.SAMPLE_RATE_KEY, sampler.getSampleRate());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getSpanEnv(DDSpan span) {
|
private static String getSpanEnv(DDSpan span) {
|
||||||
|
|
|
@ -177,13 +177,10 @@ class DDSpanTest extends Specification {
|
||||||
expect:
|
expect:
|
||||||
parent.context().samplingPriority == PrioritySampling.SAMPLER_KEEP
|
parent.context().samplingPriority == PrioritySampling.SAMPLER_KEEP
|
||||||
parent.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == PrioritySampling.SAMPLER_KEEP
|
parent.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == PrioritySampling.SAMPLER_KEEP
|
||||||
parent.getMetrics().get(DDSpanContext.SAMPLE_RATE_KEY) == 1.0
|
|
||||||
child1.getSamplingPriority() == parent.getSamplingPriority()
|
child1.getSamplingPriority() == parent.getSamplingPriority()
|
||||||
child1.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == null
|
child1.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == null
|
||||||
child1.getMetrics().get(DDSpanContext.SAMPLE_RATE_KEY) == null
|
|
||||||
child2.getSamplingPriority() == parent.getSamplingPriority()
|
child2.getSamplingPriority() == parent.getSamplingPriority()
|
||||||
child2.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == null
|
child2.getMetrics().get(DDSpanContext.PRIORITY_SAMPLING_KEY) == null
|
||||||
child2.getMetrics().get(DDSpanContext.SAMPLE_RATE_KEY) == null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def "getRootSpan returns the root span"() {
|
def "getRootSpan returns the root span"() {
|
||||||
|
|
|
@ -65,6 +65,7 @@ class RateByServiceSamplerTest extends Specification {
|
||||||
expect:
|
expect:
|
||||||
// sets correctly on root span
|
// sets correctly on root span
|
||||||
span.getSamplingPriority() == PrioritySampling.SAMPLER_KEEP
|
span.getSamplingPriority() == PrioritySampling.SAMPLER_KEEP
|
||||||
span.getMetrics().get("_sample_rate") == 1.0
|
// RateByServiceSamler must not set the sample rate
|
||||||
|
span.getMetrics().get("_sample_rate") == null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue