Add properties to select OpenTelemetry's sampler

Closes gh-49548
This commit is contained in:
Moritz Halbritter
2026-03-10 15:20:32 +01:00
parent 9699bc4e23
commit 951d37a25c
4 changed files with 135 additions and 8 deletions
@@ -150,6 +150,39 @@ Use the `management.tracing.export.zipkin.*` configuration properties to configu
[[actuator.micrometer-tracing.sampling]]
== Sampling
By default, Spring Boot samples only 10% of requests to prevent overwhelming the trace backend.
The configprop:management.tracing.sampling.probability[] property can be used to configure this.
When using OpenTelemetry, you can also configure which sampler is used via the configprop:management.opentelemetry.tracing.sampler[] property.
The following samplers are supported:
|===
|Sampler |Description
|`always-on`
|Samples every trace.
|`always-off`
|Discards every trace.
|`trace-id-ratio`
|Samples a fraction of traces based on configprop:management.tracing.sampling.probability[].
|`parent-based-always-on`
|If the parent span is sampled, samples the child span. If there is no parent, samples every trace.
|`parent-based-always-off`
|If the parent span is sampled, samples the child span. If there is no parent, discards every trace.
|`parent-based-trace-id-ratio` (default)
|If the parent span is sampled, samples the child span. If there is no parent, samples a fraction of traces based on configprop:management.tracing.sampling.probability[].
|===
[[actuator.micrometer-tracing.micrometer-observation]]
== Integration with Micrometer Observation