Skip to content

Commit

Permalink
cleanup for GetSpan (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored May 24, 2021
1 parent 8474404 commit 1a68aaf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion examples/http/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback
auto prop = opentelemetry::context::propagation::GlobalTextMapPropagator::GetGlobalPropagator();
auto current_ctx = opentelemetry::context::RuntimeContext::GetCurrent();
auto new_context = prop->Extract(carrier, current_ctx);
options.parent = GetSpanFromContext(new_context)->GetContext();
options.parent = opentelemetry::trace::propagation::GetSpan(new_context)->GetContext();

// start span with parent context extracted from http header
auto span = get_tracer("http-server")
Expand Down
13 changes: 0 additions & 13 deletions examples/http/tracer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@

namespace
{
// TBD - This function be removed once #723 is merged
inline nostd::shared_ptr<opentelemetry::trace::Span> GetSpanFromContext(
const opentelemetry::context::Context &context)
{
opentelemetry::context::ContextValue span = context.GetValue(opentelemetry::trace::kSpanKey);
if (nostd::holds_alternative<nostd::shared_ptr<opentelemetry::trace::Span>>(span))
{
return nostd::get<nostd::shared_ptr<opentelemetry::trace::Span>>(span);
}
static nostd::shared_ptr<opentelemetry::trace::Span> invalid_span{
new opentelemetry::trace::DefaultSpan(opentelemetry::trace::SpanContext::GetInvalid())};
return invalid_span;
}

template <typename T>
class HttpTextMapCarrier : public opentelemetry::context::propagation::TextMapCarrier
Expand Down

0 comments on commit 1a68aaf

Please sign in to comment.