Skip to content

Commit

Permalink
Remove redundant shutdown check in batchlogprocessor (open-telemetry#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Jan 15, 2025
1 parent 9aea826 commit 1904d4b
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,9 @@ impl LogProcessor for BatchLogProcessor {
}

fn shutdown(&self) -> LogResult<()> {
// test and set is_shutdown flag if it is not set
if self
.is_shutdown
.swap(true, std::sync::atomic::Ordering::Relaxed)
{
otel_warn!(
name: "BatchLogProcessor.Shutdown.ProcessorShutdown",
message = "BatchLogProcessor has been shutdown. No further logs will be emitted."
);
return LogResult::Err(LogError::AlreadyShutdown(
"BatchLogProcessor is already shutdown".into(),
));
}
// Set is_shutdown to true
self.is_shutdown
.store(true, std::sync::atomic::Ordering::Relaxed);

let dropped_logs = self.dropped_logs_count.load(Ordering::Relaxed);
let max_queue_size = self.max_queue_size;
Expand Down

0 comments on commit 1904d4b

Please sign in to comment.