baggage.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright The OpenTelemetry Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*
  15. Package baggage provides base types and functionality to store and retrieve
  16. baggage in Go context. This package exists because the OpenTracing bridge to
  17. OpenTelemetry needs to synchronize state whenever baggage for a context is
  18. modified and that context contains an OpenTracing span. If it were not for
  19. this need this package would not need to exist and the
  20. `go.opentelemetry.io/otel/baggage` package would be the singular place where
  21. W3C baggage is handled.
  22. */
  23. package baggage
  24. // List is the collection of baggage members. The W3C allows for duplicates,
  25. // but OpenTelemetry does not, therefore, this is represented as a map.
  26. type List map[string]Item
  27. // Item is the value and metadata properties part of a list-member.
  28. type Item struct {
  29. Value string
  30. Properties []Property
  31. }
  32. // Property is a metadata entry for a list-member.
  33. type Property struct {
  34. Key, Value string
  35. // HasValue indicates if a zero-value value means the property does not
  36. // have a value or if it was the zero-value.
  37. HasValue bool
  38. }