Skip to content

Commit 18b2752

Browse files
authored
Recommend custom header "otcorrelations" over w3c correlation-context (#517)
* Change w3c correlation context to custom header * use set-cookie format * rename header to otbaggage * update to header name in poll * fix indentation level * fix links
1 parent 1de415d commit 18b2752

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

specification/context/api-propagators.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ Implementations MAY provide global `Propagator`s for
195195
each supported `Format`.
196196

197197
If offered, the global `Propagator`s should default to a composite `Propagator`
198-
containing W3C Trace Context and Correlation Context `Propagator`s,
198+
containing the W3C Trace Context Propagator and the Correlation Context `Propagator`
199+
specified in [api-correlationcontext.md](../correlationcontext/api.md#serialization),
199200
in order to provide propagation even in the presence of no-op
200201
OpenTelemetry implementations.
201202

specification/correlationcontext/api.md

+32-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Table of Contents
1313
- [Remove correlation](#remove-correlation)
1414
- [Clear correlations](#clear-correlations)
1515
- [CorrelationContext Propagation](#correlationcontext-propagation)
16+
- [Serialization](#serialization)
1617
- [Conflict Resolution](#conflict-resolution)
1718

1819
</details>
@@ -29,8 +30,6 @@ The Correlations API consists of:
2930
`CorrelationContext` is used to annotate telemetry, adding context and information to metrics, traces, and logs.
3031
It is an abstract data type represented by a set of name/value pairs describing user-defined properties.
3132
Each name in `CorrelationContext` MUST be associated with exactly one value.
32-
`CorrelationContext` MUST be serialized according to the editor's draft of the [W3C Correlation Context](https://w3c.github.io/correlation-context/)
33-
specification.
3433

3534
### Get correlations
3635

@@ -102,6 +101,37 @@ OPTIONAL parameters:
102101
`CorrelationContext` MAY be propagated across process boundaries or across any arbitrary boundaries
103102
(process, $OTHER_BOUNDARY1, $OTHER_BOUNDARY2, etc) for various reasons.
104103

104+
### Serialization
105+
106+
Until the [W3C Correlation Context](https://w3c.github.io/correlation-context/) specification is recommended for use, OpenTelemetry `CorrelationContext` implementations MUST be serialized according to the [editor's draft of W3C Correlation Context as of March 27, 2020](https://github.com/w3c/correlation-context/blob/c974664b9ab4d33af6355f1f7f03a2d52c89a99e/correlation_context/HTTP_HEADER_FORMAT.md) using a vendor-specific header name to avoid collisions with the W3C Correlation Context specification should it change in the future.
107+
108+
#### Header Name
109+
110+
`CorrelationContext` implementations MUST use the header name `otcorrelations`.
111+
112+
#### Header Value
113+
114+
`CorrelationContext` MUST be serialized according to the [editor's draft of W3C Correlation Context as of March 27, 2020](https://github.com/w3c/correlation-context/blob/c974664b9ab4d33af6355f1f7f03a2d52c89a99e/correlation_context/HTTP_HEADER_FORMAT.md).
115+
116+
`CorrelationContext` values MUST be serialized as Percent-Encoded UTF-8 strings according to [RFC 3986 Section 2.1](https://tools.ietf.org/html/rfc3986#section-2.1).
117+
118+
#### Example
119+
120+
Correlation Context:
121+
122+
```json
123+
{
124+
"user": "[email protected]",
125+
"name": "Example Name"
126+
}
127+
```
128+
129+
Header:
130+
131+
```
132+
otcorrelations: user=foo%40example.com,name=Example%20Name
133+
```
134+
105135
## Conflict Resolution
106136

107137
If a new name/value pair is added and its name is the same as an existing name, than the new pair MUST take precedence. The value

specification/overview.md

-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ name/value pairs, called `CorrelationContext`. `CorrelationContext` is intended
196196
indexing observability events in one service with attributes provided by a prior service in
197197
the same transaction. This helps to establish a causal relationship between these events.
198198

199-
The `CorrelationContext` implements the editor's draft of the [W3C Correlation-Context specification](https://w3c.github.io/correlation-context/).
200199
While `CorrelationContext` can be used to prototype other cross-cutting concerns, this mechanism is primarily intended
201200
to convey values for the OpenTelemetry observability systems.
202201

0 commit comments

Comments
 (0)