1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-17 01:12:45 +02:00

Add baggage implementation based on the W3C and OpenTelemetry specification (#1967)

* Rename baggage context file

* Initial baggage implementation

* Initial tests

* More tests

* Update baggage context functionality

* Add New method to baggage pkg

* Update namedtracer example

* URL encode baggage values

* Refactor and use internal baggage pkg

* Update OpenTracing bridge

* Update baggage propagator

* Fix lint and test errors

* Add changes to changelog

* Apply suggestions from code review

* Rename testcase field per suggestion

* Update test to verify last-one-wins semantics

* Explicitly seed random numbers with static seed in tests

* Parse Member key/value with string split

* Add test for member parse with equal signs in value

* Trim whitespaces for member key/value
This commit is contained in:
Tyler Yahn
2021-06-08 15:06:37 +00:00
committed by GitHub
parent bbe2b8a3b6
commit 4bf6150fa9
15 changed files with 1663 additions and 936 deletions

View File

@ -59,7 +59,11 @@ func main() {
tracer := tp.Tracer("example/namedtracer/main")
ctx := context.Background()
defer func() { _ = tp.Shutdown(ctx) }()
ctx = baggage.ContextWithValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
m0, _ := baggage.NewMember(string(fooKey), "foo1")
m1, _ := baggage.NewMember(string(barKey), "bar1")
b, _ := baggage.New(m0, m1)
ctx = baggage.ContextWithBaggage(ctx, b)
var span trace.Span
ctx, span = tracer.Start(ctx, "operation")