Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Sep 19, 2022
1 parent 8c00f47 commit 5fb17a0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ template <class SpanType, class TracerType>
SpanType *new_span(TracerType *objPtr,
nostd::string_view name,
const opentelemetry::trace::StartSpanOptions &options,
std::unique_ptr<opentelemetry::trace::SpanContext> span_context)
std::unique_ptr<opentelemetry::trace::SpanContext> spanContext)
{
return new (std::nothrow) SpanType{*objPtr, name, options, std::move(span_context)};
return new (std::nothrow) SpanType{*objPtr, name, options, std::move(spanContext)};
}

/**
Expand Down Expand Up @@ -419,32 +419,32 @@ class Tracer : public opentelemetry::trace::Tracer,
auto traceId = parentContext.IsValid() ? parentContext.trace_id() : traceId_;

// Sampling based on attributes is not supported for now, so passing empty below.
std::map<std::string, int> empty_attributes = {{}};
std::map<std::string, int> emptyAttributes = {{}};
opentelemetry::sdk::trace::SamplingResult sampling_result =
GetSampler(tracerProvider_)
.ShouldSample(parentContext, traceId, name, options.kind,
opentelemetry::common::KeyValueIterableView<std::map<std::string, int>>(
empty_attributes),
emptyAttributes),
links);

opentelemetry::trace::TraceFlags trace_flags =
opentelemetry::trace::TraceFlags traceFlags =
sampling_result.decision == opentelemetry::sdk::trace::Decision::DROP
? opentelemetry::trace::TraceFlags{}
: opentelemetry::trace::TraceFlags{opentelemetry::trace::TraceFlags::kIsSampled};

auto spanContext =
std::unique_ptr<opentelemetry::trace::SpanContext>(new opentelemetry::trace::SpanContext(
traceId, GetIdGenerator(tracerProvider_).GenerateSpanId(), trace_flags, false,
traceId, GetIdGenerator(tracerProvider_).GenerateSpanId(), traceFlags, false,
sampling_result.trace_state
? sampling_result.trace_state
: parentContext.IsValid() ? parentContext.trace_state()
: opentelemetry::trace::TraceState::GetDefault()));

if (sampling_result.decision == sdk::trace::Decision::DROP)
{
auto noop_span = nostd::shared_ptr<trace::Span>{
auto noopSpan = nostd::shared_ptr<trace::Span>{
new (std::nothrow) trace::NoopSpan(this->shared_from_this(), std::move(spanContext))};
return noop_span;
return noopSpan;
}

// Populate Etw.RelatedActivityId at envelope level if enabled
Expand Down Expand Up @@ -764,12 +764,12 @@ class Span : public opentelemetry::trace::Span
Span(Tracer &owner,
nostd::string_view name,
const opentelemetry::trace::StartSpanOptions &options,
std::unique_ptr<opentelemetry::trace::SpanContext> span_context,
std::unique_ptr<opentelemetry::trace::SpanContext> spanContext,
Span *parent = nullptr) noexcept
: opentelemetry::trace::Span(),
start_time_(std::chrono::system_clock::now()),
owner_(owner),
context_(std::move(span_context)),
context_(std::move(spanContext)),
parent_(parent)
{
name_ = name;
Expand Down

0 comments on commit 5fb17a0

Please sign in to comment.