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

xdsclient: include xds node ID in errors from the WatchResource API #8093

Merged
merged 3 commits into from
Feb 15, 2025

Conversation

easwars
Copy link
Contributor

@easwars easwars commented Feb 14, 2025

Addresses first bullet point in #7931

RELEASE NOTES: none

if a.activeXDSChannel != nil {
return a.activeXDSChannel
return a.activeXDSChannel, nil
}

sc := a.xdsChannelConfigs[0].serverConfig
xc, cleanup, err := a.getChannelForADS(sc, a)
if err != nil {
a.logger.Warningf("Failed to create xDS channel: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Do we still want a warning here if we're also returning an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point. Removed.

@@ -45,7 +45,9 @@ func (c *clientImpl) WatchResource(rType xdsresource.Type, resourceName string,

if err := c.resourceTypes.maybeRegister(rType); err != nil {
logger.Warningf("Watch registered for name %q of type %q which is already registered", rType.TypeName(), resourceName)
c.serializer.TrySchedule(func(context.Context) { watcher.OnError(err, func() {}) })
c.serializer.TrySchedule(func(context.Context) {
watcher.OnError(fmt.Errorf("[xDS node id: %v]: %v", c.nodeID, err), func() {})
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should do something so that watcher.OnError always prefixes the node id automatically?

watcher := c.wrapWatcher(watcher)

or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the idea. This definitely reduces the amount of change in this PR.

@dfawley dfawley assigned easwars and unassigned dfawley Feb 14, 2025
@easwars easwars added the Type: Feature New features or improvements in behavior label Feb 14, 2025
@easwars easwars added this to the 1.71 Release milestone Feb 14, 2025
@easwars easwars assigned dfawley and unassigned easwars Feb 14, 2025
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.35%. Comparing base (59c84a9) to head (208f682).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8093      +/-   ##
==========================================
+ Coverage   82.31%   82.35%   +0.03%     
==========================================
  Files         387      387              
  Lines       38962    38967       +5     
==========================================
+ Hits        32073    32091      +18     
+ Misses       5578     5568      -10     
+ Partials     1311     1308       -3     
Files with missing lines Coverage Δ
xds/internal/xdsclient/authority.go 79.78% <100.00%> (-0.05%) ⬇️
xds/internal/xdsclient/clientimpl_watchers.go 84.41% <100.00%> (+5.54%) ⬆️

... and 24 files with indirect coverage changes

Comment on lines 36 to 38
func (w *wrappingWatcher) OnUpdate(update xdsresource.ResourceData, done xdsresource.OnDoneFunc) {
w.watcher.OnUpdate(update, done)
}
Copy link
Member

Choose a reason for hiding this comment

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

Optional: embed and delete the pass-through methods? (i.e. make the PR even smaller 😄 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sigh. I promise, that was the first thing I thought about and somehow my brain told me that I can't do it. I blame it on the ongoing Rust learning :P

@dfawley dfawley assigned easwars and unassigned dfawley Feb 14, 2025
@easwars easwars merged commit b524c08 into grpc:master Feb 15, 2025
15 checks passed
janardhanvissa pushed a commit to janardhanvissa/grpc-go that referenced this pull request Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants