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

Context Interaction Section Makes it Seem like Context Should Be Mutable #2624

Closed
Grunet opened this issue Jun 20, 2022 · 3 comments · Fixed by #2637
Closed

Context Interaction Section Makes it Seem like Context Should Be Mutable #2624

Grunet opened this issue Jun 20, 2022 · 3 comments · Fixed by #2637
Assignees
Labels
area:api Cross language API specification issue [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:context Related to the specification/context directory spec:trace Related to the specification/trace directory

Comments

@Grunet
Copy link
Contributor

Grunet commented Jun 20, 2022

What are you trying to achieve?
Was trying to implement the 2nd part of the Context Interaction section for PHP.

What did you expect to see?
I expected the spec to call out that a new context would need to be created with the span that was being passed.

Instead, the spec seemed to imply that the current context should be mutated with the span that was being passed.

Additional context.
Here is that spec language that threw me off

"Set the currently active span to the implicit context. This is equivalent to getting the implicit context, then inserting the Span to the context."

Link to this section of the doc

Fwiw I'm not sure how the spec words similar discussions of context mutability elsewhere, so if this is just being consistent with that (and me being ignorant of those parts) that seems totally fair to me (and this can be closed)

@Grunet Grunet added the spec:trace Related to the specification/trace directory label Jun 20, 2022
@joaopgrassi
Copy link
Member

joaopgrassi commented Jun 21, 2022

I think the context spec can help clarify things. There it's clearly stated that the context is immutable and its write operations must create a new context.

That document is linked in this portion of the Context Interaction

If the language has support for implicitly propagated Context (see here)

But I agree that the way it's phrased there may lead to interpretation that it's mutable. Perhaps we could add a note stating this fact and linking to the context document?

@arminru arminru added area:api Cross language API specification issue spec:context Related to the specification/context directory labels Jun 21, 2022
@Grunet
Copy link
Contributor Author

Grunet commented Jun 22, 2022

Yeah I think I was mostly second-guessing myself cause of the language even though I'd heard that before + all the existing PHP code seemed to be avoiding mutability.

It took me looking at a few other language implementations to convince myself mutability wasn't a thing.

Maybe wording something like this would avoid others from running into this?

"Set the currently active span into a new context, and make that the implicit context. This is equivalent to getting the implicit context, copying it, and then inserting the Span into the copy."

But at the end of the day it's nbd, so if it's not worth the trouble to adjust the language fine by me to close this.

@reyang reyang added the [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR label Jun 24, 2022
@rbailey7210
Copy link

Thank you for reporting this. It seems like a good PR. Would you be willing to write it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api Cross language API specification issue [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:context Related to the specification/context directory spec:trace Related to the specification/trace directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants