-
Notifications
You must be signed in to change notification settings - Fork 893
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
Clarify where Context.Key lives, and API to insert/extract from a Context instance #1020
Changes from all commits
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 |
---|---|---|
|
@@ -133,19 +133,26 @@ returned `Tracer`s and actively update their configuration if it changes. | |
## Tracing Context Utilities | ||
|
||
`Tracing Context Utilities` contains all operations within tracing that | ||
modify the [`Context`](../context/context.md). | ||
modify the [`Context`](../context/context.md). It also holds the reference to | ||
the `Context.Key` (the name MAY be `"span_context_key"`). | ||
|
||
As these utilities operate solely on the context API, they MAY be exposed | ||
as static methods on the trace module instead of a class. | ||
|
||
The `Tracing Context Utilities` MUST provide the following functions: | ||
|
||
- Get the currently active span | ||
- Set the currently active span | ||
- Get the currently active `Span` | ||
- Set the currently active `Span` | ||
- Extract the `Span` from a `Context` instance | ||
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. Should we also allow (not necessarily recommend) to just expose the key instead? With that, all the methods provided here should "be equivalent to a single parameterized method call of the 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 discussed that, please look for history in the context PR why not to do that. So the answer is NO, https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/context/context.md#create-a-key |
||
- Insert the `Span` to a `Context` instance | ||
|
||
The above methods MUST be equivalent to a single parameterized method call of | ||
the [`Context`](../context/context.md) management system. | ||
|
||
The last two methods listed above are necessary because API users don't have access to | ||
the `Context.Key` and they need to be able to insert/extract a `Span` | ||
to/from `Context` inside `Propagator` or `Tracer` implementations. | ||
|
||
## Tracer | ||
|
||
The tracer is responsible for creating `Span`s. | ||
|
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.
It's unclear what
Context.Key
is. How about this?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.
It is not necessary to store the
active
Span. Is to store a span in the context. The fact that context is active or not is an orthogonal thing.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.
What about the "the span active in a particular
Context
"?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.
I guess reference to context key is too much of an implementation detail. The semantic way of saying it is, "the only way of setting a span in a context is through methods on the trace context utilities". Does that sound right?
Note, of course I'm hoping the "trace context utilities" are allowed to be merged into other concepts like
TracerProvider
if it makes sense for the language as per my previous comment ;)