balancer: expose parent ClientConn via Unwrap() on all embedding wrappers - #9363
Closed
sushanb wants to merge 1 commit into
Closed
balancer: expose parent ClientConn via Unwrap() on all embedding wrappers#9363sushanb wants to merge 1 commit into
sushanb wants to merge 1 commit into
Conversation
…pers Several types in the balancer tree wrap a balancer.ClientConn by anonymously embedding it. Add an Unwrap() balancer.ClientConn method to each of them so that gRPC-internal callers can walk up the wrapping chain to reach the underlying parent ClientConn. This is the mirror-image contract of what errors.Unwrap provides for error trees. The method is a one-liner returning the embedded field, and doesn't change any existing behavior. It exists so a follow-up change can rely on it to inherit parent-channel telemetry (stats handlers and interceptors) onto balancer-owned control channels (e.g. the RLS control channel) without resorting to reflection over private fields. Wrappers touched: internal/balancer/gracefulswitch.balancerWrapper internal/balancergroup.subBalancerWrapper internal/xds/balancer/clusterimpl.clusterImplBalancer internal/xds/balancer/outlierdetection.outlierDetectionBalancer internal/xds/balancer/priority.ignoreResolveNowClientConn balancer/grpclb.lbCacheClientConn balancer/ringhash.ringhashBalancer RELEASE NOTES: none
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #9363 +/- ##
==========================================
- Coverage 87.45% 87.43% -0.03%
==========================================
Files 425 425
Lines 30297 30304 +7
==========================================
- Hits 26496 26495 -1
- Misses 3801 3809 +8
🚀 New features to boost your workflow:
|
Closed
2 tasks
sushanb
marked this pull request as draft
August 25, 2026 03:56
Contributor
Author
|
Converting to draft while I re-implement the fix to conform to gRFC A110 (Child Channel Options). This PR's approach (auto-inheriting the parent channel's stats handlers + interceptors via an internal walk) violates A110's explicit rule that |
2 tasks
Member
|
We generally do not prefer keeping draft PRs, please re-open the PR once the implementation is done and is ready for review. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Several types in the balancer tree wrap a
balancer.ClientConnby anonymously embedding it. This PR adds anUnwrap() balancer.ClientConnmethod to each of them so that gRPC-internal callers can walk up the wrapping chain to reach the underlying parentClientConn. This is the mirror-image contract of whaterrors.Unwrapprovides for error trees.The method is a one-liner returning the embedded field, and doesn't change any existing behavior. It exists so a follow-up change can rely on it to inherit parent-channel telemetry (stats handlers and interceptors) onto balancer-owned control channels (e.g. the RLS control channel) without resorting to reflection over private fields.
Wrappers touched
internal/balancer/gracefulswitch.balancerWrapperinternal/balancergroup.subBalancerWrapperinternal/xds/balancer/clusterimpl.clusterImplBalancerinternal/xds/balancer/outlierdetection.outlierDetectionBalancerinternal/xds/balancer/priority.ignoreResolveNowClientConnbalancer/grpclb.lbCacheClientConnbalancer/ringhash.ringhashBalancerTest plan
RELEASE NOTES: none