Skip to content

Commit 167c946

Browse files
fix(span_processor): only call on_start with recording spans (#3011)
1 parent 8e47d84 commit 167c946

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-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: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ use crate::trace::{
1313
IdGenerator, ShouldSample, SpanEvents, SpanLimits, SpanLinks,
1414
};
1515
use opentelemetry::{
16-
trace::{SamplingDecision, SpanBuilder, SpanContext, SpanKind, TraceContextExt, TraceFlags},
16+
trace::{
17+
SamplingDecision, Span as _, SpanBuilder, SpanContext, SpanKind, TraceContextExt,
18+
TraceFlags,
19+
},
1720
Context, InstrumentationScope, KeyValue,
1821
};
1922
use std::fmt;
@@ -281,9 +284,11 @@ impl opentelemetry::trace::Tracer for SdkTracer {
281284
}
282285
};
283286

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

289294
span

0 commit comments

Comments
 (0)