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

Add BaggageContext property to ChannelHandlerContext #1574

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

slashmo
Copy link
Contributor

@slashmo slashmo commented Jun 25, 2020

⚠️ This PR is not intended to ever be merged but rather meant as a playground to inspire a "real" PR once the BaggageContext has matured and was accepted by the SSWG.

Publicly expose a BaggageContext through the ChannelHandlerContext.

Motivation:

As already discussed in slashmo/gsoc-swift-tracing#48, in order to share a BaggageContext between multiple handlers on the same channel, we want to store a BaggageContext on a Channel, which is publicly accessible through the ChannelHandlerContext.

Modifications:

Result:

Users of BaggageContext and related APIs will be able to access a BaggageContext through the ChannelHandlerContext. This has the side-effect of NIO now depending on slashmo/gsoc-swift-baggage-context.

@swift-server-bot
Copy link

Can one of the admins verify this patch?

10 similar comments
@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@slashmo
Copy link
Contributor Author

slashmo commented Jun 25, 2020

@ktoso & @weissi This should now be a working version of what we discussed. I left out documentation until now if we want to move things around a bit first. For the tests I noticed that it'd be the first using the XCTExpectation API. Do you not use that on purpose? If so, I'm happy to adapt my test as well.

/// A `DeadChannelCore` is a `ChannelCore` for a `DeadChannel`. A `DeadChannel` is used as a replacement `Channel` when
/// the original `Channel` is closed. Given that the original `Channel` is closed the `DeadChannelCore` should fail
/// all operations.
private final class DeadChannelCore: ChannelCore {
var baggage = BaggageContext()
Copy link
Member

Choose a reason for hiding this comment

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

not sure about usage of DeadChannelCore, but sounds like it may be safer to never store baggage values in here, there's no real purpose to propagate using a dead channel it feels like?

@ktoso
Copy link
Member

ktoso commented Jun 25, 2020

@swift-server-bot add to whitelist // yeah seems i dont have the superpowers here 😉 thought maybe it's CI-wide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants