OpenTelemetry Certified Associate (OTCA) free question 5 / 10 · Domain 2: The OpenTelemetry API and SDK
A service sets no sampler configuration. Which sampler does the SDK use according to the environment variable specification?
- parentbased_always_on, a ParentBased sampler whose root sampler is AlwaysOn
- traceidratio, with a sampling probability of 1.0
- always_on, which samples a span without looking at the parent decision
- parentbased_always_off, which drops the root spans of new traces
Show the answer and explanation
Answer: A
Why this is correct
The default of OTEL_TRACES_SAMPLER is parentbased_always_on, which the page defines as ParentBased(root=AlwaysOnSampler). Root spans are therefore sampled, and spans with a parent follow the parent's sampling decision. The other known values include always_on, always_off, traceidratio, parentbased_always_off, and parentbased_traceidratio.
Why the other options are wrong
"always_on, which samples a span without looking at the parent decision" … The default is the ParentBased variant, so a decision made by the parent is respected.
"traceidratio, with a sampling probability of 1.0" … traceidratio is a valid value but not the default. It also does not look at the parent.
"parentbased_always_off, which drops the root spans of new traces" … The default root sampler is AlwaysOn, so new traces are sampled.
Key points
Default sampling is parent-based and records new traces. To sample a ratio, use parentbased_traceidratio with OTEL_TRACES_SAMPLER_ARG.