Skip to content
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

InMemorySpanExporter shutdown #1161

Merged
merged 2 commits into from
Dec 23, 2021
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
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