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

OpenTelemetry.Trace.Sampler

public abstract class Sampler
Controls the number of samples of traces collected and sent to the backend.
public string Description { get; protected set; }

Gets or sets the sampler description.

protected Sampler()

Initializes a new instance of the Sampler class.

protected virtual bool OnShutdown(int timeoutMilliseconds)

Called by Shutdown. This function should block the current thread until shutdown completed or timed out.

public abstract SamplingResult ShouldSample(SamplingParameters& modreq(System.Runtime.InteropServices.InAttribute) samplingParameters)

public bool Shutdown(int timeoutMilliseconds = -1)

Attempts to shut down the sampler, giving it the opportunity to release any resources it holds. Blocks the current thread until shutdown completed or timed out.