Skip to content

Commit 3dfe2ea

Browse files
add shutdown with timeout for log exporter
1 parent bc82d4f commit 3dfe2ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

opentelemetry-sdk/src/logs/export.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::Resource;
66
use opentelemetry::logs::Severity;
77
use opentelemetry::InstrumentationScope;
88
use std::fmt::Debug;
9+
use std::time;
910

1011
/// A batch of log records to be exported by a `LogExporter`.
1112
///
@@ -134,11 +135,14 @@ pub trait LogExporter: Send + Sync + Debug {
134135
&self,
135136
batch: LogBatch<'_>,
136137
) -> impl std::future::Future<Output = OTelSdkResult> + Send;
137-
138138
/// Shuts down the exporter.
139-
fn shutdown(&self) -> OTelSdkResult {
139+
fn shutdown_with_timeout(&self, _timeout: time::Duration) -> OTelSdkResult {
140140
Ok(())
141141
}
142+
/// Shuts down the exporter with a default timeout.
143+
fn shutdown(&self) -> OTelSdkResult {
144+
self.shutdown_with_timeout(time::Duration::from_secs(5))
145+
}
142146
#[cfg(feature = "spec_unstable_logs_enabled")]
143147
/// Check if logs are enabled.
144148
fn event_enabled(&self, _level: Severity, _target: &str, _name: Option<&str>) -> bool {

0 commit comments

Comments
 (0)