Skip to content

Commit

Permalink
Merge branch 'main' into AddJaegerToCI
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored May 24, 2021
2 parents 9fcf52d + 1a68aaf commit 49d26cd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ static const size_t kTraceParentSize = 55;
// The HttpTraceContext provides methods to extract and inject
// context into headers of HTTP requests with traces.
// Example:
// HttpTraceContext().inject(setter, carrier, context);
// HttpTraceContext().extract(getter, carrier, context);
// HttpTraceContext().Inject(carrier, context);
// HttpTraceContext().Extract(carrier, context);

class HttpTraceContext : public opentelemetry::context::propagation::TextMapPropagator
{
Expand Down
4 changes: 3 additions & 1 deletion ci/setup_grpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ fi
export BUILD_DIR=/tmp/
export INSTALL_DIR=/usr/local/
pushd $BUILD_DIR
git clone --recurse-submodules -b v1.34.0 https://github.com/grpc/grpc
git clone --depth=1 -b v1.34.0 https://github.com/grpc/grpc
cd grpc
git submodule init
git submodule update --depth 1
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_INSTALL=ON \
Expand Down
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 49d26cd

Please sign in to comment.