baggage.go (1672B)
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 /* 16 Package baggage provides base types and functionality to store and retrieve 17 baggage in Go context. This package exists because the OpenTracing bridge to 18 OpenTelemetry needs to synchronize state whenever baggage for a context is 19 modified and that context contains an OpenTracing span. If it were not for 20 this need this package would not need to exist and the 21 `go.opentelemetry.io/otel/baggage` package would be the singular place where 22 W3C baggage is handled. 23 */ 24 package baggage // import "go.opentelemetry.io/otel/internal/baggage" 25 26 // List is the collection of baggage members. The W3C allows for duplicates, 27 // but OpenTelemetry does not, therefore, this is represented as a map. 28 type List map[string]Item 29 30 // Item is the value and metadata properties part of a list-member. 31 type Item struct { 32 Value string 33 Properties []Property 34 } 35 36 // Property is a metadata entry for a list-member. 37 type Property struct { 38 Key, Value string 39 40 // HasValue indicates if a zero-value value means the property does not 41 // have a value or if it was the zero-value. 42 HasValue bool 43 }