File tree Expand file tree Collapse file tree
dd-trace-core/src/test/groovy/datadog/trace/common/sampling Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package datadog.trace.common.sampling
22
33import datadog.trace.api.Config
4+ import datadog.trace.api.sampling.PrioritySampling
5+ import datadog.trace.common.writer.ListWriter
6+ import datadog.trace.core.CoreTracer
7+ import datadog.trace.core.DDSpan
48import datadog.trace.test.util.DDSpecification
59
610class SamplerTest extends DDSpecification {
@@ -147,4 +151,25 @@ class SamplerTest extends DDSpecification{
147151 sampler instanceof ForcePrioritySampler
148152 ! (sampler instanceof ParentBasedAlwaysOnSampler )
149153 }
154+
155+ void " test that spans built with OTLP traces export enabled and priority sampling disabled have a non-UNSET sampling priority" () {
156+ setup :
157+ System . setProperty(" dd.trace.otel.exporter" , " otlp" )
158+ System . setProperty(" dd.priority.sampling" , " false" )
159+ Config config = new Config ()
160+ Sampler sampler = Sampler.Builder . forConfig(config, null )
161+ CoreTracer tracer = CoreTracer . builder(). writer(new ListWriter ()). sampler(sampler). build()
162+
163+ when :
164+ DDSpan span = (DDSpan ) tracer. buildSpan(" test" ). start()
165+ ((PrioritySampler ) sampler). setSamplingPriority(span)
166+
167+ then :
168+ span. getSamplingPriority() != null
169+ span. getSamplingPriority() == PrioritySampling . SAMPLER_KEEP
170+
171+ cleanup :
172+ span. finish()
173+ tracer. close()
174+ }
150175}
You can’t perform that action at this time.
0 commit comments