channelz: SubChannel do not report their Target properly since 1.63
AnomalRoil opened this issue · comments
What version of gRPC are you using?
e.g. upgrading from v1.62.2 to v1.63.2
What version of Go are you using (go version
)?
go1.22.2
What operating system (Linux, Windows, …) and version?
linux/amd64, kernel 6.8.0
What did you do?
I'm working on a custom load-balancer that acts like pick_first
, but with a fallback mechanism to avoid "sticking" to the second or third SubConn
and coming back to the first one when it's working again (to minimize latency given the locations of my endpoints).
When accessing the channelz
to get insights into my custom load balancer SubConn usage, I can no longer obtain the data about a given SubConn
by relying on GetData()
and GetTarget()
of channelz's SubChannel
since v1.63.0:
cc, _ := grpc.Dial("127.0.0.1:7555", grpc.WithTransportCredentials(insecure.NewCredentials()))
client := grpc_channelz_v1.NewChannelzClient(cc)
resp, _ := client.GetTopChannels(context.Background(), &grpc_channelz_v1.GetTopChannelsRequest{})
for _, respCh := range resp.GetChannel() {
for _, sc := range respCh.GetSubchannelRef() {
subr, err := client.GetSubchannel(context.Background(), &grpc_channelz_v1.GetSubchannelRequest{SubchannelId: sc.GetSubchannelId()})
println("Target: ", subr.GetSubchannel().GetData().GetTarget())
}
}
What did you expect to see?
This used to properly report the Target
of a SubChannel:
Target: 127.0.0.1:41573
Target: 127.0.0.1:7555
allowing me to match a given SubChannel's ChannelMetrics
with a given SubConn
in my LB.
What did you see instead?
Target:
Target:
I realize the channelz API are experimental, but this seems like a really useful information about a SubChannel
.
I could pinpoint the offending commit as being 55cd7a6 by @dfawley, but it's sadly a large diff.
(BTW, if there is a better way than relying on channelz to obtain metrics about specific SubConn, I'd love to hear about it, but its ChannelMetrics
seem to be the closest I could find to getting metrics about SubConn
usage.)
Thanks for filing the issue; I'll take a look.
I realize the channelz API are experimental
This is definitely a regression. Channelz support is not experimental, but some of the APIs around it in Go are.