Sampling ratio
If you want to sample a fixed ratio of traffic, we recommend usingTraceRatioSampler.
This is the simplest & most computationally efficient way to sample traces.
Sampling decision based on metadata:
If you want more flexibility, you can define a custom sampling decision function based on metadata.Note that this is a more computationally intensive sampling method as we need to keep all spans in a trace alive in-memory until the entire trace ends.As metadata is mutable, we can only check the sampling decision function at the end of each trace.