api
api copied to clipboard
OpenTelemetryTracingProvider: Allow configuring samplers
API part of istio/istio#50001
The OpenTelemetry project defines a Sampler API and this API is available now in Envoy. With the next Envoy release, it will also come with a Dynatrace Sampler. This API in Envoy allows anyone (vendors for ex) to add their own sampler.
This PR then adds this new configuration on Istio, containing for now the Dynatrace sampler config.
Today, there's multiple ways to configure sampling, which works/have the following precedence:
telemetry.RandomSamplingPercentage > defaultConfig.tracing.sampling > PILOT_TRACE_SAMPLING
This PR adds another option, changing the order above to:
provider.sampler > telemetry.RandomSamplingPercentage > defaultConfig.tracing.sampling > PILOT_TRACE_SAMPLING
Which means:
-
If
OpenTelemetryTracingProvider
has a custom sampler configured (what this PR adds):- Set
telemetry.RandomSamplingPercentage
to100
as all spans should arrive on the sampler, so it can perform its algorithm. This is hardcoded and the user cannot change (doesn't make sense to). Without all spans a sampler can't make consistent sampling decisions.
- Set
-
Else, continue with the same precedence as today. Essentially nothing changes when users don't use a Sampler:
telemetry.RandomSamplingPercentage > defaultConfig.tracing.sampling > PILOT_TRACE_SAMPLING
Note: I didn't add the AlwaysOn
since that is basically achieved the same way by setting the telemetry.RandomSamplingPercentage
to 100
.
CC @howardjohn @zirain