diff --git a/pkg/cache/v3/linear.go b/pkg/cache/v3/linear.go index 17f614a684..177fa8e8e9 100644 --- a/pkg/cache/v3/linear.go +++ b/pkg/cache/v3/linear.go @@ -186,7 +186,7 @@ func (cache *LinearCache) respondDelta(request *DeltaRequest, value chan DeltaRe // Only send a response if there were changes if len(resp.Resources) > 0 || len(resp.RemovedResources) > 0 { if cache.log != nil { - cache.log.Debugf("[linear cache] node: %s, sending delta response for typeURL %s with resources: %v removed resources %v with wildcard: %t", + cache.log.Debugf("[linear cache] node: %s, sending delta response for typeURL %s with resources: %v removed resources: %v with wildcard: %t", request.GetNode().GetId(), request.TypeUrl, GetResourceNames(resp.Resources), resp.RemovedResources, state.IsWildcard()) } value <- resp diff --git a/pkg/cache/v3/resource.go b/pkg/cache/v3/resource.go index 63ad0f463b..e585813d9c 100644 --- a/pkg/cache/v3/resource.go +++ b/pkg/cache/v3/resource.go @@ -112,9 +112,9 @@ func GetResourceName(res types.Resource) string { // GetResourceName returns the resource names for a list of valid xDS response types. func GetResourceNames(resources []types.Resource) []string { - out := make([]string, 0, len(resources)) - for _, r := range resources { - out = append(out, GetResourceName(r)) + out := make([]string, len(resources)) + for i, r := range resources { + out[i] = GetResourceName(r) } return out } diff --git a/pkg/cache/v3/simple.go b/pkg/cache/v3/simple.go index 951958dfc7..5f7cf5d4c0 100644 --- a/pkg/cache/v3/simple.go +++ b/pkg/cache/v3/simple.go @@ -527,7 +527,7 @@ func (cache *snapshotCache) respondDelta(ctx context.Context, snapshot ResourceS // otherwise, envoy won't complete initialization if len(resp.Resources) > 0 || len(resp.RemovedResources) > 0 || (state.IsWildcard() && state.IsFirst()) { if cache.log != nil { - cache.log.Debugf("node: %s, sending delta response for typeURL %s with resources: %v removed resources %v with wildcard: %t", + cache.log.Debugf("node: %s, sending delta response for typeURL %s with resources: %v removed resources: %v with wildcard: %t", request.GetNode().GetId(), request.TypeUrl, GetResourceNames(resp.Resources), resp.RemovedResources, state.IsWildcard()) } select {