diff --git a/api/include/opentelemetry/plugin/tracer.h b/api/include/opentelemetry/plugin/tracer.h index b0223e639a..6408bdb478 100644 --- a/api/include/opentelemetry/plugin/tracer.h +++ b/api/include/opentelemetry/plugin/tracer.h @@ -48,6 +48,8 @@ class Span final : public trace::Span bool IsRecording() const noexcept override { return span_->IsRecording(); } + trace::SpanContext GetContext() { return span_->GetContext(); } + private: std::shared_ptr tracer_; std::unique_ptr span_; @@ -72,8 +74,8 @@ class Tracer final : public trace::Tracer, public std::enable_shared_from_this{new (std::nothrow) - Span{this->shared_from_this(), std::move(span)}}; + trace::Span* spn = new (std::nothrow)Span{this->shared_from_this(), std::move(span)}; + return nostd::unique_ptr{spn}; } void ForceFlushWithMicroseconds(uint64_t timeout) noexcept override