api icon indicating copy to clipboard operation
api copied to clipboard

OpenTelemetryTracingProvider: Allow configuring samplers

Open joaopgrassi opened this issue 11 months ago • 0 comments

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 to 100 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.
  • 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

joaopgrassi avatar Mar 20 '24 15:03 joaopgrassi