Enable priority sampling by default
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/Config.java
dd-trace-api/src/main/java/datadog/trace/api/Config.java
@@ -61,7 +61,7 @@ public class Config {
private static final boolean DEFAULT_RUNTIME_CONTEXT_FIELD_INJECTION = true;
- private static final boolean DEFAULT_PRIORITY_SAMPLING_ENABLED = false;
+ private static final boolean DEFAULT_PRIORITY_SAMPLING_ENABLED = true;
private static final boolean DEFAULT_TRACE_RESOLVER_ENABLED = true;
private static final boolean DEFAULT_JMX_FETCH_ENABLED = false;

MODIFY
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
dd-trace-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy
@@ -31,7 +31,7 @@ class ConfigTest extends Specification {
config.writerType == "DDAgentWriter"
config.agentHost == "localhost"
config.agentPort == 8126
- config.prioritySamplingEnabled == false
+ config.prioritySamplingEnabled == true
config.traceResolverEnabled == true
config.serviceMapping == [:]
config.mergedSpanTags == [:]
@@ -54,7 +54,7 @@ class ConfigTest extends Specification {
System.setProperty(PREFIX + AGENT_HOST, "somehost")
System.setProperty(PREFIX + TRACE_AGENT_PORT, "123")
System.setProperty(PREFIX + AGENT_PORT_LEGACY, "456")
- System.setProperty(PREFIX + PRIORITY_SAMPLING, "true")
+ System.setProperty(PREFIX + PRIORITY_SAMPLING, "false")
System.setProperty(PREFIX + TRACE_RESOLVER_ENABLED, "false")
System.setProperty(PREFIX + SERVICE_MAPPING, "a:1")
System.setProperty(PREFIX + GLOBAL_TAGS, "b:2")
@@ -77,7 +77,7 @@ class ConfigTest extends Specification {
config.writerType == "LoggingWriter"
config.agentHost == "somehost"
config.agentPort == 123
- config.prioritySamplingEnabled == true
+ config.prioritySamplingEnabled == false
config.traceResolverEnabled == false
config.serviceMapping == [a: "1"]
config.mergedSpanTags == [b: "2", c: "3"]
@@ -177,7 +177,7 @@ class ConfigTest extends Specification {
properties.setProperty(WRITER_TYPE, "LoggingWriter")
properties.setProperty(AGENT_HOST, "somehost")
properties.setProperty(TRACE_AGENT_PORT, "123")
- properties.setProperty(PRIORITY_SAMPLING, "true")
+ properties.setProperty(PRIORITY_SAMPLING, "false")
properties.setProperty(TRACE_RESOLVER_ENABLED, "false")
properties.setProperty(SERVICE_MAPPING, "a:1")
properties.setProperty(GLOBAL_TAGS, "b:2")
@@ -198,7 +198,7 @@ class ConfigTest extends Specification {
config.writerType == "LoggingWriter"
config.agentHost == "somehost"
config.agentPort == 123
- config.prioritySamplingEnabled == true
+ config.prioritySamplingEnabled == false
config.traceResolverEnabled == false
config.serviceMapping == [a: "1"]
config.mergedSpanTags == [b: "2", c: "3"]

MODIFY
dd-trace-ot/src/test/groovy/datadog/trace/DDTracerTest.groovy
dd-trace-ot/src/test/groovy/datadog/trace/DDTracerTest.groovy
@@ -42,21 +42,20 @@ class DDTracerTest extends Specification {
then:
tracer.serviceName == "unnamed-java-app"
- tracer.sampler instanceof AllSampler
+ tracer.sampler instanceof RateByServiceSampler
tracer.writer.toString() == "DDAgentWriter { api=DDApi { tracesEndpoint=http://localhost:8126/v0.3/traces } }"
tracer.spanContextDecorators.size() == 12
}
+
def "verify overriding sampler"() {
setup:
- System.setProperty(PREFIX + PRIORITY_SAMPLING, "true")
-
+ System.setProperty(PREFIX + PRIORITY_SAMPLING, "false")
when:
def tracer = new DDTracer(new Config())
-
then:
- tracer.sampler instanceof RateByServiceSampler
+ tracer.sampler instanceof AllSampler
}
def "verify overriding writer"() {
@@ -136,7 +135,7 @@ class DDTracerTest extends Specification {
where:
key | value
- Config.PRIORITY_SAMPLING | "true"
- Config.PRIORITY_SAMPLING | "false"
+ PRIORITY_SAMPLING | "true"
+ PRIORITY_SAMPLING | "false"
}
}

Enable priority sampling by default