Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description of TraceState operations #905

Merged
merged 7 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ byte.
TraceFlags are present in all traces. The current version of the specification
only supports a single flag called [sampled](https://www.w3.org/TR/trace-context/#sampled-flag).

`TraceState` carries system-specific configuration data, represented as a list
`TraceState` carries vendor-specific trace identification data, represented as a list
of key-value pairs. TraceState allows multiple tracing
systems to participate in the same trace. Please review the [W3C
specification](https://www.w3.org/TR/trace-context/#tracestate-header) for
details on this field.
systems to participate in the same trace. It is fully described in [W3C
iNikem marked this conversation as resolved.
Show resolved Hide resolved
specification](https://www.w3.org/TR/trace-context/#tracestate-header).

### Retrieving the TraceId and SpanId

Expand Down
18 changes: 18 additions & 0 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,24 @@ Thus, the SDK specification defines sets of possible requirements for
(for example, the `Span` could be one of the parameters passed to such a function,
or a getter could be provided).

## TraceState manipulation

`TraceState` is a part of [`SpanContext`](./api.md#spancontext), represented by a list of string key-values pairs and
iNikem marked this conversation as resolved.
Show resolved Hide resolved
formally defined by [W3C specification](https://www.w3.org/TR/trace-context/#tracestate-header).
iNikem marked this conversation as resolved.
Show resolved Hide resolved
Tracing SDK MUST provide at least the following operations on `TraceState` which return a new `TraceState` with the modifications applied:
iNikem marked this conversation as resolved.
Show resolved Hide resolved

* Update key value
iNikem marked this conversation as resolved.
Show resolved Hide resolved
iNikem marked this conversation as resolved.
Show resolved Hide resolved
* Add a new key/value pair
iNikem marked this conversation as resolved.
Show resolved Hide resolved
* Delete a key/value pair

These operations MUST follow rules described in [W3C specification](https://www.w3.org/TR/trace-context/#mutating-the-tracestate-field).
iNikem marked this conversation as resolved.
Show resolved Hide resolved

Please note, that as `SpanContext` is immutable, it is not possible to update `SpanContext` with a new `TraceState`.
iNikem marked this conversation as resolved.
Show resolved Hide resolved
Such changes then make sense only right before
[`SpanContext` propagation](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/context/api-propagators.md)
or [telemetry data exporting](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#span-exporter).
In both cases `Propagators` and `SpanExporters` may create a modified `TraceState` copy before serializing it to the wire.
iNikem marked this conversation as resolved.
Show resolved Hide resolved

## Span processor

Span processor is an interface which allows hooks for span start and end method
Expand Down