Skip to content

xds: remove HealthStatus field from xdsresource.Endpoint struct#9023

Closed
chengxilo wants to merge 7 commits intogrpc:masterfrom
chengxilo:remove-endpoint-healthstatus
Closed

xds: remove HealthStatus field from xdsresource.Endpoint struct#9023
chengxilo wants to merge 7 commits intogrpc:masterfrom
chengxilo:remove-endpoint-healthstatus

Conversation

@chengxilo
Copy link
Copy Markdown
Contributor

Part of : #8757

This PR removes the HealthStatus field from the xdsresource.Endpoint struct and adds it as an attribute while un-marshalling EDS instead of setting it as an attribute later on in cluster resolver balancer

RELEASE NOTES: None

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.95%. Comparing base (b71c262) to head (5d97bf2).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9023      +/-   ##
==========================================
- Coverage   83.01%   82.95%   -0.06%     
==========================================
  Files         411      411              
  Lines       32960    32969       +9     
==========================================
- Hits        27361    27350      -11     
- Misses       4196     4211      +15     
- Partials     1403     1408       +5     
Files with missing lines Coverage Δ
internal/xds/balancer/cdsbalancer/configbuilder.go 91.17% <100.00%> (+0.06%) ⬆️
...nternal/xds/xdsclient/xdsresource/unmarshal_eds.go 96.38% <100.00%> (+0.18%) ⬆️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pranjali-2501 Pranjali-2501 added Type: Internal Cleanup Refactors, etc Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Mar 29, 2026
@Pranjali-2501 Pranjali-2501 added this to the 1.81 Release milestone Mar 29, 2026
@Pranjali-2501 Pranjali-2501 self-requested a review March 29, 2026 19:13
Copy link
Copy Markdown
Contributor

@Pranjali-2501 Pranjali-2501 left a comment

Choose a reason for hiding this comment

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

@chengxilo , Thanks for your PR.

Comment thread internal/xds/balancer/cdsbalancer/configbuilder_test.go Outdated
Comment thread internal/xds/xdsclient/xdsresource/unmarshal_eds_test.go Outdated
Comment thread internal/xds/xdsdepmgr/xds_dependency_manager_test.go Outdated
@chengxilo
Copy link
Copy Markdown
Contributor Author

solved😊

@chengxilo chengxilo requested a review from Pranjali-2501 March 29, 2026 20:58
Copy link
Copy Markdown
Contributor

@Pranjali-2501 Pranjali-2501 left a comment

Choose a reason for hiding this comment

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

LGTM.

Assigning it to @arjan-bal for second review.

Comment thread internal/xds/xdsclient/xdsresource/unmarshal_eds.go Outdated
Comment on lines +286 to +287
hs := xdsresource.HealthStatus(endpoint.ResolverEndpoint)
if hs != xdsresource.EndpointHealthStatusHealthy && hs != xdsresource.EndpointHealthStatusUnknown {
Copy link
Copy Markdown
Contributor

@arjan-bal arjan-bal Mar 31, 2026

Choose a reason for hiding this comment

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

I'm not entirely convinced that moving the health status to attributes is beneficial. I have a few concerns:

  1. Unlike the hashkey and weight fields, health status is not currently propagated to LB policies via Endpoint attributes, so moving them doesn't result in memory savings or reduced code complexity.
  2. Attributes are designed for untyped data. Moving these fields requires type erasure during insertion and type assertions during extraction, which seems unnecessary. The existing Endpoint struct provides better compile-time safety by avoiding this overhead.

@easwars, regarding #8757, what is the primary motivation for removing the Endpoint struct? Is that benefit significant enough to justify the loss of type safety when passing these values through internal packages?

Copy link
Copy Markdown
Contributor

@easwars easwars Apr 7, 2026

Choose a reason for hiding this comment

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

Upon further thought, I agree that it does not make sense to move things like health status into attributes because they are not plumbed down the LB policy tree. The same applies to the current Weight field in the Endpoint struct, because that is used only by the CDS policy to determine the eventual weight of the Endpoint which is then set as an attribute for LB policies like pick_first and ring_hash to consume. So, at the moment, we are left with HealthStatus and Weight fields which are not plumbed down the LB policy tree and therefore don't make sense to be carried as attributes. And Metadata is complicated to be carried in an attribute.

@chengxilo : I appreciate your efforts on attempting to fix these issues, and I apologize for not having given enough thought before filing them and marking them as "Help Wanted". Hope you can contribute to our repo through other open issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Internal Cleanup Refactors, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants