-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Experiment(secret-manager): add tracing transport logic to google-cloud-secret-manager #18188
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
Open
chalmerlowe
wants to merge
3
commits into
feat/otel-tracing-eager-channel-wrapping
Choose a base branch
from
feat/otel-tracing-transport-logic
base: feat/otel-tracing-eager-channel-wrapping
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
696200e
feat(secretmanager): integrate eager channel creation and interceptor…
chalmerlowe f2b6829
docs(secretmanager): add descriptive docstrings to OTel and transport…
chalmerlowe 2669ca4
feat(secretmanager): pass lazy partial channel factory when OTel trac…
chalmerlowe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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 left a comment here, suggesting that we may be able to accept
Callable[[Channel], Channel]here to support otel's interceptorUh oh!
There was an error while loading. Please reload this page.
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.
❌ Not Recommended
There are a couple of structural reasons why keeping
apply_interceptorsfocused strictly onSequence[ClientInterceptor]is preferred over also acceptingCallable[[Channel], Channel]:Keeping
channelas the channel factory parameter (supportingfunctools.partial) andinterceptorsas the standard gRPC RPC interceptor parameter gives each argument a single clear responsibility across both sync and async transports.Calling
grpc.intercept_channel(channel, *interceptors)in batch produces a single_InterceptedChanneldispatcher. If we intersperse true interceptors with callables to create (OR modify) channels, things get complicated. We would likely need an intervening step to loop through and examine each item in the interceptor parameter to decide whether it needs calling OR not.grpc.aio):In
grpc.aio, channels are immutable once constructed, and there is no post-creation interceptor wrapper. OTel's async interceptor must be passed directly intogrpc.aio.secure_channel(..., interceptors=[...])during channel creation. ACallable[[Channel], Channel]pattern cannot execute in async, which would force sync and async transports to diverge in how they handle interceptors OR necessitate that we inject an intermediary step to handle Channels versus Interceptors.Uh oh!
There was an error while loading. Please reload this page.
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'm not sure I understand. keeping channel creation and interceptor application separate is what I'm arguing for. The current design couples the grpc interceptor into the channel creation logic, and decouples the rest, which I find to be a confusing design
I also don't understand this argument either, and it makes me wonder if you misunderstand what I'm suggesting here.
grpc.intercept_channelcall, that's already what grpc.intercept_channel does under the hood. Note that each interceptor applied creates a new _Channel. intercept_channel itself is fundamentally aCallable[[Channel], Channel]operation, which is why I think this design works well. We're just extending off of grpc's existing wrapping logicThis is true, but that's because grpc.aio gives us a different API to work with, so I think it makes sense that we also expose a different