Skip to content

Commit fedc965

Browse files
committed
chore: don't shadow names
1 parent 794f28e commit fedc965

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/shared/pkg/grpc/channelz.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ func createInProcessChannelzClient() (channelzpb.ChannelzClient, func(), error)
264264
return channelzpb.NewChannelzClient(conn), closeFn, nil
265265
}
266266

267-
func sampleChannelzConnections(ctx context.Context, client channelzpb.ChannelzClient, state *channelzSamplerState) {
267+
func sampleChannelzConnections(ctx context.Context, client channelzpb.ChannelzClient, samplerState *channelzSamplerState) {
268268
countsByType := map[string]map[channelzpb.ChannelConnectivityState_State]int64{}
269-
for _, clientType := range state.registeredClientTypes() {
269+
for _, clientType := range samplerState.registeredClientTypes() {
270270
countsByType[clientType] = map[channelzpb.ChannelConnectivityState_State]int64{}
271271
}
272272

@@ -293,9 +293,9 @@ func sampleChannelzConnections(ctx context.Context, client channelzpb.ChannelzCl
293293
continue
294294
}
295295

296-
clientType := detectChannelzClientType(state, target)
296+
clientType := detectChannelzClientType(samplerState, target)
297297
if clientType == channelzClientTypeUnknown {
298-
state.logUnknownTargetOnce(ctx, target)
298+
samplerState.logUnknownTargetOnce(ctx, target)
299299
}
300300

301301
if _, ok := countsByType[clientType]; !ok {
@@ -304,21 +304,21 @@ func sampleChannelzConnections(ctx context.Context, client channelzpb.ChannelzCl
304304

305305
subRefs := ch.GetSubchannelRef()
306306
if len(subRefs) == 0 {
307-
state := channelzpb.ChannelConnectivityState_UNKNOWN
307+
connState := channelzpb.ChannelConnectivityState_UNKNOWN
308308
if data := ch.GetData(); data != nil && data.GetState() != nil {
309-
state = data.GetState().GetState()
309+
connState = data.GetState().GetState()
310310
}
311311

312-
countsByType[clientType][state]++
312+
countsByType[clientType][connState]++
313313
} else {
314314
for _, subRef := range subRefs {
315315
subResp, err := client.GetSubchannel(ctx, &channelzpb.GetSubchannelRequest{SubchannelId: subRef.GetSubchannelId()})
316316
if err != nil {
317317
continue
318318
}
319319

320-
state := subResp.GetSubchannel().GetData().GetState().GetState()
321-
countsByType[clientType][state]++
320+
subchannelState := subResp.GetSubchannel().GetData().GetState().GetState()
321+
countsByType[clientType][subchannelState]++
322322
}
323323
}
324324
}
@@ -351,9 +351,9 @@ func sampleChannelzConnections(ctx context.Context, client channelzpb.ChannelzCl
351351
}
352352
}
353353

354-
state.mu.Lock()
355-
state.counts = newCounts
356-
state.mu.Unlock()
354+
samplerState.mu.Lock()
355+
samplerState.counts = newCounts
356+
samplerState.mu.Unlock()
357357
}
358358

359359
func isInProcessChannelzTarget(target string) bool {

0 commit comments

Comments
 (0)