Skip to content

Commit

Permalink
InMemorySpanExporter shutdown fix (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Dec 23, 2021
1 parent 1cf2422 commit bb9d5de
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class InMemorySpanExporter final : public opentelemetry::sdk::trace::SpanExporte
sdk::common::ExportResult Export(
const nostd::span<std::unique_ptr<sdk::trace::Recordable>> &recordables) noexcept override
{
if (is_shutdown_)
{
return sdk::common::ExportResult::kFailure;
}
for (auto &recordable : recordables)
{
auto span = std::unique_ptr<sdk::trace::SpanData>(
Expand All @@ -63,6 +67,7 @@ class InMemorySpanExporter final : public opentelemetry::sdk::trace::SpanExporte
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override
{
is_shutdown_ = true;
return true;
};

Expand All @@ -76,6 +81,7 @@ class InMemorySpanExporter final : public opentelemetry::sdk::trace::SpanExporte

private:
std::shared_ptr<opentelemetry::exporter::memory::InMemorySpanData> data_;
bool is_shutdown_ = false;
};
} // namespace memory
} // namespace exporter
Expand Down

0 comments on commit bb9d5de

Please sign in to comment.