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

Remove restriction that SpanContext must be a final class, specify creation. #969

Merged
merged 12 commits into from
Sep 26, 2020
11 changes: 10 additions & 1 deletion specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ the same `TracerProvider`.

A `SpanContext` represents the portion of a `Span` which must be serialized and
propagated along side of a distributed context. `SpanContext`s are immutable.
`SpanContext` MUST be a final (sealed) class.

The OpenTelemetry `SpanContext` representation conforms to the [W3C TraceContext
specification](https://www.w3.org/TR/trace-context/). It contains two
Expand All @@ -180,6 +179,16 @@ of key-value pairs. TraceState allows multiple tracing
systems to participate in the same trace. It is fully described in the [W3C Trace Context
specification](https://www.w3.org/TR/trace-context/#tracestate-header).

The API must provide methods to create a `SpanContext`. These methods SHOULD be the only way to
anuraaga marked this conversation as resolved.
Show resolved Hide resolved
create a `SpanContext` There are three ways to create a `SpanContext`:
anuraaga marked this conversation as resolved.
Show resolved Hide resolved

- By generating a new `SpanId`, `TraceId`, and `TraceFlags` when there is no in-process or remote parent.
Oberon00 marked this conversation as resolved.
Show resolved Hide resolved
- By generating a new `SpanId` and `TraceFlags` and copying the `TraceId` and `TraceState` from
Oberon00 marked this conversation as resolved.
Show resolved Hide resolved
an in-process parent.
- By accepting values for the `SpanId`, `TraceId`, `TraceFlags`, and `TraceState` for a remote
parent. In this case, the `SpanId`, `TraceId`, and `TraceFlags` must be used as is, and
`TraceState` may be modified based on the rules for modification described below.
Oberon00 marked this conversation as resolved.
Show resolved Hide resolved

### Retrieving the TraceId and SpanId

The API MUST allow retrieving the `TraceId` and `SpanId` in the following forms:
Expand Down