ddtrace Sampling¶
Warning
This example uses ddtrace version 0.114.0 (latest) for testing
Prerequisites¶
-
Enable the DataKit ddtrace collector
-
Prepare Shell
java -javaagent:D:/ddtrace/dd-java-agent-0.114.0.jar \
-Ddd.service.name=ddtrace-server \
-Ddd.agent.port=9529 \
-jar springboot-ddtrace-server.jar
Installation and Deployment¶
1 Sampler Configuration in ddtrace.conf¶
## Sampler config uses to set global sampling strategy.
## sampling_rate used to set global sampling rate.
[inputs.ddtrace.sampler]
sampling_rate = 0.1
2 Test Script¶
3 Enable Sampling¶
- Enable Sampling on the Collector Side
The range of sampling_rate is (0,1). If the value is outside this range, the trace is discarded.
If full sampling is required, do not configure [inputs.ddtrace.sampler].
- Enable Sampling on the Application Side
Enable sampling on the application side by using -Ddd.trace.sample.rate, with the range (0,1).
This is a tagged sampling, meaning the trace is fully collected while a sampling tag is applied.
- Sampling Priority
Both sampling methods have the same effect. If both are configured, the collector-side sampling does not take effect. That is:
Summary
-Ddd.trace.sample.rate > sampling_rate