Skip to content

Commit de49068

Browse files
committed
Catch missing errors
1 parent 26bbdc4 commit de49068

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

opentelemetry-sdk/src/logs/log_processor_with_async_runtime.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ impl<R: RuntimeChannel> BatchLogProcessor<R> {
188188
)
189189
.await;
190190

191-
exporter.shutdown();
191+
if let Err(shutdown_error) = exporter.shutdown() {
192+
otel_debug!(
193+
name: "BatchLogProcessor.Shutdown.Error",
194+
error = format!("{}", shutdown_error),
195+
);
196+
}
192197

193198
if let Err(send_error) = ch.send(result) {
194199
otel_debug!(
@@ -282,7 +287,7 @@ where
282287

283288
#[cfg(all(test, feature = "testing", feature = "logs"))]
284289
mod tests {
285-
use crate::export::logs::{LogBatch, LogExporter};
290+
use crate::export::logs::{LogBatch, LogExporter, ShutdownResult};
286291
use crate::logs::log_processor::{
287292
OTEL_BLRP_EXPORT_TIMEOUT, OTEL_BLRP_MAX_EXPORT_BATCH_SIZE, OTEL_BLRP_MAX_QUEUE_SIZE,
288293
OTEL_BLRP_SCHEDULE_DELAY,
@@ -325,7 +330,9 @@ mod tests {
325330
async { Ok(()) }
326331
}
327332

328-
fn shutdown(&mut self) {}
333+
fn shutdown(&mut self) -> ShutdownResult {
334+
Ok(())
335+
}
329336

330337
fn set_resource(&mut self, resource: &Resource) {
331338
self.resource

opentelemetry-sdk/src/trace/span_processor_with_async_runtime.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,12 @@ impl<R: RuntimeChannel> BatchSpanProcessorInternal<R> {
287287
// Stream has terminated or processor is shutdown, return to finish execution.
288288
BatchMessage::Shutdown(ch) => {
289289
self.flush(Some(ch)).await;
290-
self.exporter.shutdown();
290+
if let Err(shutdown_error) = self.exporter.shutdown() {
291+
otel_debug!(
292+
name: "BatchSpanProcessor.ShutdownError",
293+
msg = format!("{:?}", shutdown_error)
294+
);
295+
}
291296
return false;
292297
}
293298
// propagate the resource

0 commit comments

Comments
 (0)