Skip to content

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

Merged
easwars merged 3 commits into
grpc:masterfrom
easwars:xds_node_id_in_xdsclient_errors
Feb 15, 2025
Merged

easwars merged 3 commits into
grpc:masterfrom
easwars:xds_node_id_in_xdsclient_errors

Conversation

@easwars

@easwars easwars commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

Addresses first bullet point in #7931

RELEASE NOTES: none

Comment thread xds/internal/xdsclient/authority.go Outdated
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
Copy Markdown
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
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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
@codecov

codecov Bot commented Feb 14, 2025 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
janardhanvissa pushed a commit to janardhanvissa/grpc-go that referenced this pull request Feb 15, 2025
@easwars
easwars deleted the xds_node_id_in_xdsclient_errors branch March 10, 2025 22:06
janardhanvissa pushed a commit to janardhanvissa/grpc-go that referenced this pull request Mar 24, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants