You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propagation - Extract handles multiple values on carrier using same key (#4295)
Fixes#433
Discussed in 11/5/24 Spec SIG, and prototyped in Java and Go.
## Changes
Adds `GetAll` method to Getter, allowing for the retrieval of multiple
keys for the same value. For example, an HTTP request may have multiple
`baggage` headers.
As written in the changes, the implementation of `GetAll` is strictly
optional. This is for two reasons:
1. Backwards compatibility with existing types/interfaces
2. Carriers do not necessarily support returning multiple values for a
single key
## Links to Prototypes
This includes implementations of `GetAll()` in Java and Go, as well as
using the method in the W3C Baggage Propagators (multiple baggage
headers are allowed, [spec
reference](https://www.w3.org/TR/baggage/#baggage-http-header-format)).
- Java: open-telemetry/opentelemetry-java#6852
- Go: open-telemetry/opentelemetry-go#5973
* [x] Links to the prototypes (when adding or changing features)
* [x]
[`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md)
file updated for non-trivial changes
---------
Co-authored-by: Trask Stalnaker <[email protected]>
Co-authored-by: jack-berg <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
**Status**: [Stable](../document-status.md), except where otherwise specified.
4
4
5
5
<details>
6
6
<summary>Table of Contents</summary>
@@ -22,6 +22,7 @@
22
22
+[Getter argument](#getter-argument)
23
23
-[Keys](#keys)
24
24
-[Get](#get)
25
+
-[GetAll](#getall)
25
26
-[Injectors and Extractors as Separate Interfaces](#injectors-and-extractors-as-separate-interfaces)
26
27
-[Composite Propagator](#composite-propagator)
27
28
*[Create a Composite Propagator](#create-a-composite-propagator)
@@ -196,11 +197,11 @@ Returns a new `Context` derived from the `Context` passed as argument.
196
197
197
198
#### Getter argument
198
199
199
-
Getter is an argument in `Extract` that get value from given field
200
+
Getter is an argument in `Extract` that gets value(s) from given field.
200
201
201
202
`Getter` allows a `TextMapPropagator` to read propagated fields from a carrier.
202
203
203
-
One of the ways to implement it is `Getter` class with `Get` and `Keys` methods
204
+
One of the ways to implement it is `Getter` class with methods `Get`, `Keys`, and `GetAll`
204
205
as described below. Languages may decide on alternative implementations and
205
206
expose corresponding methods as delegates or other ways.
206
207
@@ -227,7 +228,28 @@ Required arguments:
227
228
- the carrier of propagation fields, such as an HTTP request.
228
229
- the key of the field.
229
230
230
-
The Get function is responsible for handling case sensitivity. If the getter is intended to work with a HTTP request object, the getter MUST be case insensitive.
231
+
The Get function is responsible for handling case sensitivity. If the getter is intended to work with an HTTP request object, the getter MUST be case insensitive.
232
+
233
+
##### GetAll
234
+
235
+
**Status**: [Development](../document-status.md)
236
+
237
+
For many language implementations, the `GetAll` function will be added after the stable release of `Getter`.
238
+
For these languages, requiring implementations of `Getter` to include `GetAll` constitutes a breaking change
239
+
since instrumentation which previously functioned would fail. Language implementations should be cognizant
240
+
of this, and add `GetAll` in a way that retains backwards compatibility. For example, by providing a default
241
+
`GetAll` implementation based on Get, or by creating an extended `Getter` type.
242
+
243
+
If explicitly implemented, the `GetAll` function MUST return all values of the given propagation key.
244
+
It SHOULD return them in the same order as they appear in the carrier.
245
+
If the key doesn't exist, it SHOULD return an empty collection.
246
+
247
+
Required arguments:
248
+
249
+
- the carrier of propagation fields, such as an HTTP request.
250
+
- the key of the field.
251
+
252
+
The `GetAll` function is responsible for handling case sensitivity. If the getter is intended to work with an HTTP request object, the getter MUST be case insensitive.
231
253
232
254
## Injectors and Extractors as Separate Interfaces
0 commit comments