1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Simplify trace_context tests (#2108)

* Simplify trace_context tests

Refactor the propagation/trace_context tests to be targeted at testing
the propagator functionality only and remove extraneous dependencies.

Fix the TraceContext Inject method from injecting the tracestate header
if no value exists.

* Add changes to changelog
This commit is contained in:
Tyler Yahn
2021-07-21 09:15:40 -07:00
committed by GitHub
parent 56d420112f
commit 49359495c7
3 changed files with 176 additions and 193 deletions

View File

@@ -50,7 +50,9 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
return
}
carrier.Set(tracestateHeader, sc.TraceState().String())
if ts := sc.TraceState().String(); ts != "" {
carrier.Set(tracestateHeader, ts)
}
// Clear all flags other than the trace-context supported sampling bit.
flags := sc.TraceFlags() & trace.FlagsSampled