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

xds/internal/xdsclient: Add counter metrics for valid and invalid resource updates #8038

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

zasweq
Copy link
Contributor

@zasweq zasweq commented Jan 24, 2025

This PR adds counter metrics for the xDS Client, and unit tests. E2E tests still need to be written.

The gauge metrics are blocked on adding support for asynchronous gauges, and we also should move our synchronous gauges in RLS to asynchronous.

RELEASE NOTES:

  • xds/internal/xdsclient: Add counter metrics for valid and invalid resource updates

@zasweq zasweq requested a review from dfawley January 24, 2025 22:21
@zasweq zasweq added the Type: Feature New features or improvements in behavior label Jan 24, 2025
@zasweq zasweq added this to the 1.71 Release milestone Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.33%. Comparing base (79b6830) to head (0505f28).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8038      +/-   ##
==========================================
- Coverage   82.42%   82.33%   -0.09%     
==========================================
  Files         387      387              
  Lines       39042    39066      +24     
==========================================
- Hits        32179    32165      -14     
- Misses       5546     5576      +30     
- Partials     1317     1325       +8     
Files with missing lines Coverage Δ
resolver/resolver.go 100.00% <ø> (ø)
resolver_wrapper.go 84.29% <100.00%> (+0.13%) ⬆️
server.go 82.35% <100.00%> (+0.04%) ⬆️
xds/internal/resolver/xds_resolver.go 79.04% <100.00%> (+0.38%) ⬆️
xds/internal/xdsclient/authority.go 77.11% <100.00%> (+0.24%) ⬆️
xds/internal/xdsclient/clientimpl.go 79.67% <100.00%> (+0.50%) ⬆️
xds/internal/xdsclient/pool.go 79.41% <100.00%> (+0.62%) ⬆️
xds/server.go 82.42% <100.00%> (+0.21%) ⬆️

... and 28 files with indirect coverage changes

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, just a few small things.

But I'm also worried this will conflict with some changes @purnesh42H is working on?

@purnesh42H
Copy link
Contributor

Removing "Required Reporter Clarification" status since this PR might have to wait for #8050

@zasweq zasweq force-pushed the xds-client-metrics-count branch from 23257e2 to 17e74b9 Compare February 4, 2025 20:07
@zasweq zasweq assigned dfawley and unassigned zasweq Feb 4, 2025
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

@purnesh42H should probably take a pass but this LGTM. Thanks @zasweq!

@dfawley dfawley assigned purnesh42H and unassigned dfawley Feb 4, 2025
@dfawley dfawley requested a review from purnesh42H February 4, 2025 20:52
Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

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

LGTM. 2 minor comments. Are these the only 2 counters we need or more?

"google.golang.org/grpc/internal/xds/bootstrap"
)

var (
// DefaultPool is the default pool for xDS clients. It is created at init
// time by reading bootstrap configuration from env vars.
DefaultPool *Pool
DefaultPool *Pool
xdsClientResourceUpdatesValidMetric = estats.RegisterInt64Count(estats.MetricDescriptor{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the right place for the counters is clientimpl.go file as its not related to pool. In fact, I think we even DefaultPool should be in clientimpl.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done. Left DefaultPool here to keep this PR focused. I think DefaultPool makes sense either way, where it is now keeps it closer to type Pool but whatever you think is best moving forward.

if err != nil {
t.Fatalf("Failed to create bootstrap configuration: %v", err)
}
// Create an xDS client for use by the cluster_resolver LB policy.
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any relevance of cluster_resolver LB policy for this test? Because we are only testing listener resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good point haha.

onDone()
}

// TestResourceUpdateMetrics configures an xDS Client and provides a valid and
Copy link
Contributor

Choose a reason for hiding this comment

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

// TestResourceUpdateMetrics configures an xDS client, and a management server to send valid and
// invalid LDS updates, and verifies that the expected metrics for both good and bad
// updates are emitted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@zasweq
Copy link
Contributor Author

zasweq commented Feb 6, 2025

These are the only two counters. The other three xDS Client are gauge metrics. For correctness reasons, we need to switch our synchronous gauges to asynchronous gauges before implementing those three.

@zasweq zasweq merged commit 267a09b into grpc:master Feb 7, 2025
14 of 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.

3 participants