-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
balancer: Move metrics recorder from BuildOptions to ClientConn #8027
Merged
Conversation
This file contains 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8027 +/- ##
==========================================
- Coverage 82.47% 82.23% -0.24%
==========================================
Files 387 387
Lines 39037 39040 +3
==========================================
- Hits 32194 32106 -88
- Misses 5530 5602 +72
- Partials 1313 1332 +19
|
dfawley
reviewed
Jan 23, 2025
277d7ad
to
7d97e03
Compare
Merged a PR to avoid breakages in grpc-gcp-go: GoogleCloudPlatform/grpc-gcp-go#91 |
dfawley
approved these changes
Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: Resolvers/Balancers
Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities.
Type: API Change
Breaking API changes (experimental APIs only!)
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.
This PR changes the way LB policies obtain a metrics recorder from the channel. Earlier LB policies obtained it through the
BuildOptions
. Now the LB policies need to call theMetricsRecorder
method on the ClientConn.Why
When LB policies manage child policies, they need to correctly propagate the BuildOptions. If they fail to pass down the
MetricsRecorder
in theBuildOptions
, it will read to nil pointer deferences when the child tries to record metrics. There is no way for gRPC to enforce LB polices propagate the MetricsRecorder. #8026 is open to enforce LB policies embed an existingClientConn
object. Using a method onClientConn
ensures that theMetricsRecorder
can be obtained from the channel, unless explicitly intercepted by an LB policy. TheMetricsRecorder
field in theBuildOptions
was added in the past 6 months, so we don't expect too many breakages in external code.RELEASE NOTES:
MetricsRecorder
method onBalancer.ClientConn
instead of the removedBalancer.BuildOptions.MetricsRecorder
field to obtain a metrics recorder.