Skip to content

Commit fc645af

Browse files
committed
Remove logic for actually enabling ParentBasedSampler
1 parent cee3a77 commit fc645af

2 files changed

Lines changed: 1 addition & 51 deletions

File tree

dd-trace-core/src/main/java/datadog/trace/common/sampling/Sampler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ public static Sampler forConfig(final Config config, final TraceConfig traceConf
8080
log.error("Invalid sampler configuration. Using AllSampler", e);
8181
sampler = new AllSampler();
8282
}
83-
} else if (config.isTraceOtlpExporterEnabled()) {
84-
sampler = new ParentBasedAlwaysOnSampler();
83+
// TODO: if OTLP trace export enabled, select ParentBasedAlwaysOnSampler here
8584
} else if (config.isPrioritySamplingEnabled()) {
8685
if (KEEP.equalsIgnoreCase(config.getPrioritySamplingForce())) {
8786
log.debug("Force Sampling Priority to: SAMPLER_KEEP.");

dd-trace-core/src/test/groovy/datadog/trace/common/sampling/SamplerTest.groovy

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -66,53 +66,4 @@ class SamplerTest extends DDSpecification{
6666
then:
6767
!(sampler instanceof AsmStandaloneSampler)
6868
}
69-
70-
void "test that ParentBasedAlwaysOnSampler is selected when otlp traces exporter enabled"() {
71-
setup:
72-
System.setProperty("dd.trace.otel.exporter", "otlp")
73-
Config config = new Config()
74-
75-
when:
76-
Sampler sampler = Sampler.Builder.forConfig(config, null)
77-
78-
then:
79-
sampler instanceof ParentBasedAlwaysOnSampler
80-
}
81-
82-
void "test that ParentBasedAlwaysOnSampler is not selected when otlp traces exporter not set"() {
83-
setup:
84-
Config config = new Config()
85-
86-
when:
87-
Sampler sampler = Sampler.Builder.forConfig(config, null)
88-
89-
then:
90-
!(sampler instanceof ParentBasedAlwaysOnSampler)
91-
}
92-
93-
void "test that user-defined sampling rules take precedence over otlp default sampler"() {
94-
setup:
95-
System.setProperty("dd.trace.otel.exporter", "otlp")
96-
System.setProperty("dd.trace.sample.rate", "0.5")
97-
Config config = new Config()
98-
99-
when:
100-
Sampler sampler = Sampler.Builder.forConfig(config, null)
101-
102-
then:
103-
sampler instanceof RuleBasedTraceSampler
104-
}
105-
106-
void "test that DD_TRACE_SAMPLING_RULES takes precedence over otlp default sampler"() {
107-
setup:
108-
System.setProperty("dd.trace.otel.exporter", "otlp")
109-
System.setProperty("dd.trace.sampling.rules", '[{"sample_rate": 0.5}]')
110-
Config config = new Config()
111-
112-
when:
113-
Sampler sampler = Sampler.Builder.forConfig(config, null)
114-
115-
then:
116-
sampler instanceof RuleBasedTraceSampler
117-
}
11869
}

0 commit comments

Comments
 (0)