Skip to content

Conversation

@mbissa
Copy link
Contributor

@mbissa mbissa commented Dec 2, 2025

Address: https://github.com/grpc/proposal/blob/master/A89-backend-service-metric-label.md

This PR makes available the backend_service (cluster name) label which is decided in clusterimpl (since we are pre-A75). It is added to WRR per-call metrics.

RELEASE NOTES:

  • stats/otel: add backend service label to wrr metrics as part of A89

@mbissa mbissa added this to the 1.78 Release milestone Dec 2, 2025
@mbissa mbissa self-assigned this Dec 2, 2025
@mbissa mbissa added Type: Feature New features or improvements in behavior Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability labels Dec 2, 2025
@mbissa mbissa requested a review from easwars December 2, 2025 08:29
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.37%. Comparing base (432bda3) to head (6155d55).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8737      +/-   ##
==========================================
+ Coverage   83.22%   83.37%   +0.15%     
==========================================
  Files         419      418       -1     
  Lines       32454    32377      -77     
==========================================
- Hits        27009    26994      -15     
+ Misses       4057     4017      -40     
+ Partials     1388     1366      -22     
Files with missing lines Coverage Δ
balancer/weightedroundrobin/balancer.go 86.08% <100.00%> (+0.52%) ⬆️
balancer/weightedroundrobin/scheduler.go 96.22% <100.00%> (ø)
internal/xds/balancer/clusterimpl/clusterimpl.go 83.72% <100.00%> (ø)

... and 40 files with indirect coverage changes

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

@mbissa mbissa assigned arjan-bal and easwars and unassigned arjan-bal Dec 2, 2025
@easwars easwars changed the title stats/otel: Adds grpc.lb.backend_service label to wrr metrics (A89) stats/otel: Add grpc.lb.backend_service label to wrr metrics (A89) Dec 2, 2025
@easwars
Copy link
Contributor

easwars commented Dec 2, 2025

@mbissa
While we get this change reviewed and merged, could you also please file an issue to track the fact that we need to move the changes to set the cluster_name resolver attribute over to the cds LB policy once A75 is implemented. Thanks.

FYI: @Pranjali-2501

@easwars easwars removed their assignment Dec 2, 2025
@mbissa
Copy link
Contributor Author

mbissa commented Dec 3, 2025

@mbissa While we get this change reviewed and merged, could you also please file an issue to track the fact that we need to move the changes to set the cluster_name resolver attribute over to the cds LB policy once A75 is implemented. Thanks.

FYI: @Pranjali-2501

We don't need it anymore. A75 already captures that in the gRFC itself.

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

LGTM, modulo minor nits


// SetBackendServiceOnState stores the backendService on the resolver state so
// that it can be used later as a label in wrr metrics.
func SetBackendServiceOnState(state resolver.State, backendService string) resolver.State {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can we drop the OnState suffix on this one please. I checked a whole bunch of attribute setter functions and none of them have a suffix like this. Thanks.

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.

"time"

"google.golang.org/grpc/balancer"
wrr "google.golang.org/grpc/balancer/weightedroundrobin"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid this unnecessary import renaming. See: go/go-style/decisions#import-renaming

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.

return err
}

newState := wrr.SetBackendServiceOnState(s.ResolverState, b.clusterName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we eliminate this local variable and inline it on line 303?

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.

@easwars easwars removed their assignment Dec 3, 2025
@mbissa mbissa merged commit f9d2bdb into grpc:master Dec 8, 2025
14 checks passed
@mbissa mbissa deleted the a89-adding-backend-service-label-wrr branch December 8, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants