Skip to content

Commit b220635

Browse files
committed
remove single processor optimization
1 parent f7786e1 commit b220635

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

opentelemetry-sdk/src/logs/log_emitter.rs

+10-26
Original file line numberDiff line numberDiff line change
@@ -216,33 +216,17 @@ impl opentelemetry::logs::Logger for Logger {
216216
cx.has_active_span()
217217
.then(|| TraceContext::from(cx.span().span_context()))
218218
});
219-
// Prioritize the scenario where there is likely to be only one processor.
220-
if processors.len() == 1 {
221-
// If there is exactly one processor, use the record directly.
222-
if let Some(p) = processors.first() {
223-
let mut record = record; // Move the record directly, avoiding clone.
224-
if let Some(ref trace_context) = trace_context {
225-
record.trace_context = Some(trace_context.clone());
226-
}
227-
let data = LogData {
228-
record,
229-
instrumentation: self.instrumentation_library().clone(),
230-
};
231-
p.emit(data);
232-
}
233-
} else {
234-
// For multiple processors, clone the record for each.
235-
for p in processors {
236-
let mut cloned_record = record.clone();
237-
if let Some(ref trace_context) = trace_context {
238-
cloned_record.trace_context = Some(trace_context.clone());
239-
}
240-
let data = LogData {
241-
record: cloned_record,
242-
instrumentation: self.instrumentation_library().clone(),
243-
};
244-
p.emit(data);
219+
220+
for p in processors {
221+
let mut cloned_record = record.clone();
222+
if let Some(ref trace_context) = trace_context {
223+
cloned_record.trace_context = Some(trace_context.clone());
245224
}
225+
let data = LogData {
226+
record: cloned_record,
227+
instrumentation: self.instrumentation_library().clone(),
228+
};
229+
p.emit(data);
246230
}
247231
}
248232

0 commit comments

Comments
 (0)