MCPcopy
hub / github.com/grpc/grpc-go / channelzSubChannels

Method channelzSubChannels

internal/xds/test/e2e/e2e.go:99–120  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

97}
98
99func (c *client) channelzSubChannels(ctx context.Context) ([]*channelzpb.Subchannel, error) {
100 ccc := channelzgrpc.NewChannelzClient(c.statsCC)
101 r, err := ccc.GetTopChannels(ctx, &channelzpb.GetTopChannelsRequest{})
102 if err != nil {
103 return nil, err
104 }
105
106 var ret []*channelzpb.Subchannel
107 for _, cc := range r.Channel {
108 if cc.Data.Target != c.target {
109 continue
110 }
111 for _, sc := range cc.SubchannelRef {
112 rr, err := ccc.GetSubchannel(ctx, &channelzpb.GetSubchannelRequest{SubchannelId: sc.SubchannelId})
113 if err != nil {
114 return nil, err
115 }
116 ret = append(ret, rr.Subchannel)
117 }
118 }
119 return ret, nil
120}
121
122func (c *client) stop() {
123 c.cmd.Process.Kill()

Callers 1

TestAffinityFunction · 0.80

Calls 2

GetTopChannelsMethod · 0.95
GetSubchannelMethod · 0.95

Tested by 1

TestAffinityFunction · 0.64