diff --git a/examples/http/server.cc b/examples/http/server.cc index a9f1a81e08..190f40eac1 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -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") diff --git a/examples/http/tracer_common.h b/examples/http/tracer_common.h index 2f517e5601..276ed3d9a2 100644 --- a/examples/http/tracer_common.h +++ b/examples/http/tracer_common.h @@ -16,19 +16,6 @@ namespace { -// TBD - This function be removed once #723 is merged -inline nostd::shared_ptr GetSpanFromContext( - const opentelemetry::context::Context &context) -{ - opentelemetry::context::ContextValue span = context.GetValue(opentelemetry::trace::kSpanKey); - if (nostd::holds_alternative>(span)) - { - return nostd::get>(span); - } - static nostd::shared_ptr invalid_span{ - new opentelemetry::trace::DefaultSpan(opentelemetry::trace::SpanContext::GetInvalid())}; - return invalid_span; -} template class HttpTextMapCarrier : public opentelemetry::context::propagation::TextMapCarrier