Repository navigation
balancer: Move metrics recorder from BuildOptions to ClientConn - #8027
Merged
Merged
Conversation
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
arjan-bal
force-pushed
the
move-metrics-recorder
branch
from
January 27, 2025 10:33
277d7ad to
7d97e03
Compare
Contributor
Author
|
Merged a PR to avoid breakages in grpc-gcp-go: GoogleCloudPlatform/grpc-gcp-go#91 |
dfawley
approved these changes
Jan 27, 2025
janardhanvissa
pushed a commit
to janardhanvissa/grpc-go
that referenced
this pull request
Feb 15, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 theMetricsRecordermethod on the ClientConn.Why
When LB policies manage child policies, they need to correctly propagate the BuildOptions. If they fail to pass down the
MetricsRecorderin 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 existingClientConnobject. Using a method onClientConnensures that theMetricsRecordercan be obtained from the channel, unless explicitly intercepted by an LB policy. TheMetricsRecorderfield in theBuildOptionswas added in the past 6 months, so we don't expect too many breakages in external code.RELEASE NOTES:
MetricsRecordermethod onBalancer.ClientConninstead of the removedBalancer.BuildOptions.MetricsRecorderfield to obtain a metrics recorder.