<PackageReference Include="OpenTelemetry" Version="1.11.2" />

OpenTelemetry.Trace.ParentBasedSampler

public sealed class ParentBasedSampler : Sampler
Sampler implementation which by default will take a sample if parent Activity is sampled. Otherwise, samples root traces according to the specified root sampler.
public ParentBasedSampler(Sampler rootSampler)

Initializes a new instance of the ParentBasedSampler class.

public ParentBasedSampler(Sampler rootSampler, Sampler remoteParentSampled = null, Sampler remoteParentNotSampled = null, Sampler localParentSampled = null, Sampler localParentNotSampled = null)

Initializes a new instance of the ParentBasedSampler class with ability to delegate sampling decision to one of the inner samplers provided.