Skip to content

Commit e648455

Browse files
authored
feat(trace): impl ShouldSample for Box<dyn ShouldSample>
1 parent f46bccc commit e648455

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

opentelemetry-sdk/src/trace/sampler.rs

+15
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ impl Clone for Box<dyn ShouldSample> {
102102
}
103103
}
104104

105+
impl ShouldSample for Box<dyn ShouldSample> {
106+
fn should_sample(
107+
&self,
108+
parent_context: Option<&Context>,
109+
trace_id: TraceId,
110+
name: &str,
111+
span_kind: &SpanKind,
112+
attributes: &[KeyValue],
113+
links: &[Link],
114+
) -> SamplingResult {
115+
self.as_ref()
116+
.should_sample(parent_context, trace_id, name, span_kind, attributes, links)
117+
}
118+
}
119+
105120
/// Default Sampling options
106121
///
107122
/// The [built-in samplers] allow for simple decisions. For more complex scenarios consider

0 commit comments

Comments
 (0)