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

Clarify where Context.Key lives, and API to insert/extract from a Context instance #1020

Closed
wants to merge 4 commits into from

Conversation

bogdandrutu
Copy link
Member

Signed-off-by: Bogdan Drutu [email protected]

Updates #1019

@bogdandrutu bogdandrutu requested review from a team September 25, 2020 22:33
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been brainstorming integrating trace context methods into Span itself

static Span.current()
Scope Span.makeCurrent()
static Span fromContext(Context ctx)
Context addToContext(Context ctx)

I think this could be a simpler Java API where static util methods are not so idiomatic. Does the spec preclude merging pieces pieces together (Span and TraceContextUtils) in this sort of way?

@bogdandrutu
Copy link
Member Author

@anuraaga please add this comment to the issue linked by this PR. You still need 2 static methods in your example, not sure if that solves that problem, but let's discuss in the issue where I have more examples and explanations.

@carlosalberto carlosalberto added release:required-for-ga Must be resolved before GA release, or nice to have before GA spec:context Related to the specification/context directory labels Sep 28, 2020
specification/trace/api.md Outdated Show resolved Hide resolved
specification/trace/api.md Outdated Show resolved Hide resolved
- Set the currently active span
- Get the currently active `Span`
- Set the currently active `Span`
- Extract the `Span` from a `Context` instance
Copy link
Member

Choose a reason for hiding this comment

The 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 Context management system".

Copy link
Member Author

@bogdandrutu bogdandrutu Sep 29, 2020

Choose a reason for hiding this comment

The 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

Signed-off-by: Bogdan Drutu <[email protected]>
@@ -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"`).
Copy link
Member

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?

Suggested change
the `Context.Key` (the name MAY be `"span_context_key"`).
the `Context` key used for storing the currently active span
(usually called `Context.Key` or `span_context_key` in implementations).

Copy link
Member Author

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.

Copy link
Member

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"?

Copy link
Contributor

@anuraaga anuraaga Oct 2, 2020

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 ;)

specification/trace/api.md Outdated Show resolved Hide resolved
@Oberon00 Oberon00 dismissed their stale review October 1, 2020 17:45

Resolved

@jmacd
Copy link
Contributor

jmacd commented Oct 5, 2020

Update from the TC meeting: @bogdandrutu will re-do this PR to show the desired final state of the world.

@bogdandrutu
Copy link
Member Author

This is no longer needed, a different PR has been filed that fixes the entire issue, see #1063

@bogdandrutu bogdandrutu closed this Oct 6, 2020
@bogdandrutu bogdandrutu deleted the contextkey branch October 6, 2020 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:required-for-ga Must be resolved before GA release, or nice to have before GA spec:context Related to the specification/context directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants