Skip to content
Closed
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
5 changes: 4 additions & 1 deletion api/include/opentelemetry/trace/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ inline nostd::shared_ptr<Span> GetSpan(const context::Context &context) noexcept
{
return nostd::get<nostd::shared_ptr<Span>>(span);
}
return nostd::shared_ptr<Span>(new DefaultSpan(SpanContext::GetInvalid()));

static thread_local nostd::shared_ptr<Span> invalid_span =
nostd::shared_ptr<Span>(new DefaultSpan(SpanContext::GetInvalid()));
return invalid_span;
}

inline bool IsRootSpan(const context::Context &context) noexcept
Expand Down
Loading