diff --git a/exporters/ostream/src/log_exporter.cc b/exporters/ostream/src/log_exporter.cc index c11ec13786..59cbe7cda4 100644 --- a/exporters/ostream/src/log_exporter.cc +++ b/exporters/ostream/src/log_exporter.cc @@ -149,7 +149,7 @@ sdk::common::ExportResult OStreamLogExporter::Export( << " severity_num : " << static_cast(log_record->GetSeverity()) << "\n" << " severity_text : "; - int severity_index = static_cast(log_record->GetSeverity()); + std::size_t severity_index = static_cast(log_record->GetSeverity()); if (severity_index < 0 || severity_index >= std::extent::value) { @@ -181,7 +181,7 @@ sdk::common::ExportResult OStreamLogExporter::Export( return sdk::common::ExportResult::kSuccess; } -bool OStreamLogExporter::Shutdown(std::chrono::microseconds timeout) noexcept +bool OStreamLogExporter::Shutdown(std::chrono::microseconds) noexcept { const std::lock_guard locked(lock_); is_shutdown_ = true; diff --git a/exporters/otlp/src/otlp_http_client.cc b/exporters/otlp/src/otlp_http_client.cc index 2e66c8373c..5fa2c7cf8b 100644 --- a/exporters/otlp/src/otlp_http_client.cc +++ b/exporters/otlp/src/otlp_http_client.cc @@ -595,8 +595,7 @@ OtlpHttpClient::~OtlpHttpClient() { if (!isShutdown()) { - Shutdown(std::chrono::duration_cast( - std::chrono::steady_clock::time_point::max() - std::chrono::steady_clock::now())); + Shutdown(); } // Wait for all the sessions to finish @@ -756,10 +755,20 @@ bool OtlpHttpClient::Shutdown(std::chrono::microseconds timeout) noexcept // Wait for all the sessions to finish std::unique_lock lock(session_waker_lock_); - session_waker_.wait_for(lock, timeout, [this] { - std::lock_guard guard{session_manager_lock_}; - return running_sessions_.empty(); - }); + if (timeout == std::chrono::microseconds::zero()) + { + session_waker_.wait(lock, [this] { + std::lock_guard guard{session_manager_lock_}; + return running_sessions_.empty(); + }); + } + else + { + session_waker_.wait_for(lock, timeout, [this] { + std::lock_guard guard{session_manager_lock_}; + return running_sessions_.empty(); + }); + } while (cleanupGCSessions()) ;