-
Notifications
You must be signed in to change notification settings - Fork 926
Clarify context interaction for trace module #1063
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
Changes from all commits
cf67c3d
682cefa
db1ea77
e03ec77
dd12c37
b7f2152
16e17ec
ce0c497
74d72de
d027841
58ce14d
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ Table of Contents | |
* [Duration](#duration) | ||
* [TracerProvider](#tracerprovider) | ||
* [TracerProvider operations](#tracerprovider-operations) | ||
* [Tracing Context Utilities](#tracing-context-utilities) | ||
* [Context Interaction](#context-interaction) | ||
* [Tracer](#tracer) | ||
* [Tracer operations](#tracer-operations) | ||
* [SpanReference](#spanreference) | ||
|
@@ -127,21 +127,32 @@ the tracer could, for example, do a look-up with its name+version in a map in | |
the `TracerProvider`, or the `TracerProvider` could maintain a registry of all | ||
returned `Tracer`s and actively update their configuration if it changes. | ||
|
||
## Tracing Context Utilities | ||
## Context Interaction | ||
|
||
`Tracing Context Utilities` contains all operations within tracing that | ||
modify the [`Context`](../context/context.md). | ||
This section defines all operations within the Tracing API that interact with the | ||
[`Context`](../context/context.md). | ||
|
||
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 API MUST provide the following functionality to interact with a `Context` | ||
instance: | ||
|
||
The `Tracing Context Utilities` MUST provide the following functions: | ||
- Extract the `Span` from a `Context` instance | ||
- Insert the `Span` to a `Context` instance | ||
|
||
- Get the currently active span | ||
- Set the currently active span | ||
The functionality listed above is necessary because API users SHOULD NOT have | ||
access to the [Context Key](../context/context.md#create-a-key) used by the Tracing API implementation. | ||
|
||
The above methods MUST be equivalent to a single parameterized method call of | ||
the [`Context`](../context/context.md) management system. | ||
If the language has support for implicitly propagated `Context` (see | ||
[here](../context/context.md#optional-global-operations)), the API SHOULD also provide | ||
the following functionality: | ||
|
||
- Get the currently active span from the implicit context. This is equivalent to getting the implicit context, then extracting the `Span` from the context. | ||
- Set the currently active span to the implicit context. This is equivalent to getting the implicit context, then inserting the `Span` to the context. | ||
|
||
All the above functionalities operate solely on the context API, and they MAY be | ||
exposed as static methods on the trace module, as static methods on a class | ||
inside the trace module (it MAY be named `TracingContextUtilities`), or on the | ||
[`Tracer`](#tracer) class. This functionality SHOULD be fully implemented in 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. Breaking news - there seems to be a lot of support for removing the mention of 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. The spec here does not say that this should be on the tracer, and if it is, it says it should be static. 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. Ah static is written twice, but not a third time. So with this wording, static does not apply to Tracer I think and I didn't read it that way. If it's also static it makes sense to me. 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. What one language decided to do is not breaking news :) In the Ruby implementation they want to work directly with @bogdandrutu to just clarify, we still allow this to exist as instance methods in 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. I think we should discourage an instance method on tracer, as this has been known to cause confusion and has caused people to call for allowing an unnamed tracer just to access the current span. 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.
I agree. 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. I think the current text does exactly that, and in edge cases where that cannot be avoided, it allows to be an instance method. 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. open-telemetry/opentelemetry-ruby#425 (comment) TL;DR: I agree, including for Ruby. |
||
API when possible. | ||
|
||
## Tracer | ||
|
||
|
@@ -156,13 +167,6 @@ The `Tracer` MUST provide functions to: | |
|
||
- [Create a new `Span`](#span-creation) (see the section on `Span`) | ||
|
||
The `Tracer` MAY provide functions to: | ||
bogdandrutu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- Get the currently active span | ||
- Set the currently active span | ||
|
||
These functions MUST delegate to the `Tracing Context Utilities`. | ||
|
||
## SpanReference | ||
|
||
A `SpanReference` represents the portion of a `Span` which must be serialized and | ||
|
Uh oh!
There was an error while loading. Please reload this page.