Skip to main content
Sampling in a distributed OpenTelemetry system requires coordination between services to ensure consistent sampling decisions across your entire application. In a microservice architecture, every service needs to use the same sampling method to maintain trace consistency. Without this coordination, you might end up with incomplete traces where some spans are sampled while others are not.

Main Orchestrating Application

Set the sampling method in your primary service that initiates requests:

All Other Microservices

Configure downstream services to inherit the sampling decision from the main application:

How This Works

  1. Parent-based sampling: The ParentBased(ALWAYS_ON) sampler checks if there’s a parent span from another service
  2. Inheritance: If a parent span exists and was sampled, the child service will also sample
  3. Consistency: This ensures that either the entire distributed trace is sampled or none of it is