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

channelz: SubChannel do not report their Target properly since 1.63 #7187

Closed
AnomalRoil opened this issue May 3, 2024 · 1 comment · Fixed by #7189
Closed

channelz: SubChannel do not report their Target properly since 1.63 #7187

AnomalRoil opened this issue May 3, 2024 · 1 comment · Fixed by #7189
Assignees

Comments

@AnomalRoil
Copy link
Contributor

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.)

@dfawley
Copy link
Member

dfawley commented May 3, 2024

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.

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

Successfully merging a pull request may close this issue.

2 participants