Skip to content

core: Implement load balancing policy delay plumbing#12807

Draft
AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:lb-policy-delay
Draft

core: Implement load balancing policy delay plumbing#12807
AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:lb-policy-delay

Conversation

@AgraVator
Copy link
Copy Markdown
Contributor

This PR implements the plumbing required to propagate delay reason tokens from load balancing policies up to the transport layer and tracers, as specified in the LB policy delay design.

What changed

  • api: Added delayReasonToken to PickResult and factory method withNoResult(String).
  • api: Added delayStarted(String) and delayEnded() hooks to ClientStreamTracer to track delay segments.
  • core: Updated DelayedClientTransport to track delay tokens in PendingStream and notify tracers when delays start, change, or end.
  • core/util: Updated PickFirst and RoundRobin policies to emit cached tokens when connecting.
  • xds: Updated RingHash, RLS, and CDS policies to emit specific delay tokens when buffering picks.
  • xds: Updated PriorityLoadBalancer to wrap child pickers and prepend priority_X: to child tokens to track failovers.

Tests

  • Added unit tests in DelayedClientTransportTest for token propagation and cancellation.
  • Added assertions for tokens in existing tests for PickFirst, RoundRobin, RingHash, and RLS.
  • Added a new test in CdsLoadBalancer2Test for cds:discovery_pending state.
  • Added a nested test in RingHashLoadBalancerTest to verify pass-through behavior of child tokens.
  • Added a test in PriorityLoadBalancerTest to verify token prefixing.

Notes

  • This change focuses strictly on the plumbing of the delay reasons. Implementation of actual OpenTelemetry metrics and spans is deferred to a later phase.

This commit implements the plumbing required to propagate delay reason tokens from load balancing policies up to the transport layer and tracers, as specified in the LB policy delay design.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant