Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ETW Exporter] - Add Trace flags in SpanContext #1618

Merged
merged 8 commits into from
Sep 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
lalitb committed Sep 15, 2022

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
commit eab88dd48d2b1637a78df274cb4e317aa14a4cab
15 changes: 8 additions & 7 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h
Original file line number Diff line number Diff line change
@@ -416,23 +416,24 @@ class Tracer : public opentelemetry::trace::Tracer,
parentContext = spanContext;
}
}
auto sampling_result =
auto traceId = parentContext.IsValid() ? parentContext.trace_id() : traceId_;

// Sampling based on attributes is not supported for now, so passing empty below.
opentelemetry::sdk::trace::SamplingResult sampling_result =
GetSampler(tracerProvider_)
.ShouldSample(parentContext, traceId_, name, options.kind, attributes, links);
.ShouldSample(parentContext, traceId, name, options.kind, {}, links);

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

auto traceId = parentContext.IsValid() ? parentContext.trace_id() : traceId_;

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

if (sampling_result.decision == sdk::trace::Decision::DROP)