Skip to content

Commit

Permalink
Don't set empty Tracestate header
Browse files Browse the repository at this point in the history
  • Loading branch information
yzsolt committed May 5, 2022
1 parent 46dd2c1 commit 3a295ad
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ class HttpTraceContext : public opentelemetry::context::propagation::TextMapProp
nostd::span<char, 2>{&trace_parent[kTraceIdSize + kSpanIdSize + 5], 2});

carrier.Set(kTraceParent, nostd::string_view(trace_parent, sizeof(trace_parent)));
carrier.Set(kTraceState, span_context.trace_state()->ToHeader());
const auto trace_state = span_context.trace_state()->ToHeader();
if (!trace_state.empty())
{
carrier.Set(kTraceState, trace_state);
}
}

static SpanContext ExtractContextFromTraceHeaders(nostd::string_view trace_parent,
Expand Down

0 comments on commit 3a295ad

Please sign in to comment.