Trait opentelemetry::sdk::trace::ShouldSample
source · pub trait ShouldSample: Send + Sync + Debug {
// Required method
fn should_sample(
&self,
parent_context: Option<&Context>,
trace_id: TraceId,
name: &str,
span_kind: &SpanKind,
attributes: &[KeyValue],
links: &[Link],
instrumentation_library: &InstrumentationLibrary
) -> SamplingResult;
}
Expand description
The ShouldSample
interface allows implementations to provide samplers
which will return a sampling SamplingResult
based on information that
is typically available just before the Span
was created.
Required Methods§
sourcefn should_sample(
&self,
parent_context: Option<&Context>,
trace_id: TraceId,
name: &str,
span_kind: &SpanKind,
attributes: &[KeyValue],
links: &[Link],
instrumentation_library: &InstrumentationLibrary
) -> SamplingResult
fn should_sample( &self, parent_context: Option<&Context>, trace_id: TraceId, name: &str, span_kind: &SpanKind, attributes: &[KeyValue], links: &[Link], instrumentation_library: &InstrumentationLibrary ) -> SamplingResult
Returns the SamplingDecision
for a Span
to be created.