Skip to content

Remove redundant shutdown check in batchlogprocessor #2514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
@@ -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;