-
Notifications
You must be signed in to change notification settings - Fork 896
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
Changes from 4 commits
09c18ec
e5a7786
9bd8dd7
1aa7d16
e9fafdb
b04b3d4
7fb7b4b
5b5a5df
ca2a68b
6c37693
d36af6c
c18cabc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 `SpanContext`. There are three ways to create | ||
a `SpanContext` | ||
|
||
- By generating a new `SpanId` and `TraceId` when there is no in-process or remote parent. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a way to provide TraceFlags and TraceState for root spans too. Actually at least TraceFlags should be a required parameter (sampled vs unsampled) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks - yeah I added the point about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We absolutely do. @iNikem added some descriptions how a tracestate can be "modifified" recently (the actual object instances are immutable but you can create a modified copy). Of course there must be some way of associating a tracestate with a spancontext too. |
||
- By generating a new `SpanId` and copying the `TraceId`, `TraceFlags`, and `TraceState` from | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There must definitely be a way to change the TraceFlags (sampled) at this point. I think there should also be a way to change the TraceState. Maybe we could cover this by adding an additional mode of creation that accepts only a TraceState + original SpanContext and leaves everything else (including the "remoteness") unchanged. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup makes sense. I think #988 addresses being able to mutate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #998 would allow the sampler to choose a tracestate, but the SDK would then need to construct a new SpanContext with that tracestate, which will only work if there is an option to create a SpanContext with a tracestate. I also want to keep reflecting the current state, which is, for example in Java, that you have the option (actually the obligation) to pass a tracestate, no matter whether the spancontext is remote or local. |
||
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: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, what I would prefer but it's probably too late for that rather large change: