Skip to content

Commit 80806e1

Browse files
committed
fix(span_processor): only call on_start with recording spans
According to the spec, spans that are not recording should not be passed to span processors.
1 parent 8e47d84 commit 80806e1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

opentelemetry-sdk/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## vNext
44

5+
- TODO: Placeholder for Span processor related things
6+
- *Fix* SpanProcessor::on_start is no longer called on non recording spans
7+
58
## 0.30.0
69

710
Released 2025-May-23

opentelemetry-sdk/src/trace/tracer.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::trace::{
1313
IdGenerator, ShouldSample, SpanEvents, SpanLimits, SpanLinks,
1414
};
1515
use opentelemetry::{
16-
trace::{SamplingDecision, SpanBuilder, SpanContext, SpanKind, TraceContextExt, TraceFlags},
16+
trace::{SamplingDecision, Span as _, SpanBuilder, SpanContext, SpanKind, TraceContextExt, TraceFlags},
1717
Context, InstrumentationScope, KeyValue,
1818
};
1919
use std::fmt;
@@ -281,9 +281,11 @@ impl opentelemetry::trace::Tracer for SdkTracer {
281281
}
282282
};
283283

284-
// Call `on_start` for all processors
285-
for processor in provider.span_processors() {
286-
processor.on_start(&mut span, parent_cx)
284+
if span.is_recording() {
285+
// Call `on_start` for all processors
286+
for processor in provider.span_processors() {
287+
processor.on_start(&mut span, parent_cx)
288+
}
287289
}
288290

289291
span

0 commit comments

Comments
 (0)