Skip to content

Commit

Permalink
[ingester_query] change var "clients" to "reps" (#3274)
Browse files Browse the repository at this point in the history
  • Loading branch information
liguozhong authored Feb 1, 2021
1 parent b4eeddc commit 0986d8d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/querier/ingester_querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,31 @@ func (q *IngesterQuerier) forGivenIngesters(ctx context.Context, replicationSet
}

func (q *IngesterQuerier) SelectLogs(ctx context.Context, params logql.SelectLogParams) ([]iter.EntryIterator, error) {
clients, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
resps, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
return client.Query(ctx, params.QueryRequest, stats.CollectTrailer(ctx))
})
if err != nil {
return nil, err
}

iterators := make([]iter.EntryIterator, len(clients))
for i := range clients {
iterators[i] = iter.NewQueryClientIterator(clients[i].response.(logproto.Querier_QueryClient), params.Direction)
iterators := make([]iter.EntryIterator, len(resps))
for i := range resps {
iterators[i] = iter.NewQueryClientIterator(resps[i].response.(logproto.Querier_QueryClient), params.Direction)
}
return iterators, nil
}

func (q *IngesterQuerier) SelectSample(ctx context.Context, params logql.SelectSampleParams) ([]iter.SampleIterator, error) {
clients, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
resps, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
return client.QuerySample(ctx, params.SampleQueryRequest, stats.CollectTrailer(ctx))
})
if err != nil {
return nil, err
}

iterators := make([]iter.SampleIterator, len(clients))
for i := range clients {
iterators[i] = iter.NewSampleQueryClientIterator(clients[i].response.(logproto.Querier_QuerySampleClient))
iterators := make([]iter.SampleIterator, len(resps))
for i := range resps {
iterators[i] = iter.NewSampleQueryClientIterator(resps[i].response.(logproto.Querier_QuerySampleClient))
}
return iterators, nil
}
Expand All @@ -146,16 +146,16 @@ func (q *IngesterQuerier) Label(ctx context.Context, req *logproto.LabelRequest)
}

func (q *IngesterQuerier) Tail(ctx context.Context, req *logproto.TailRequest) (map[string]logproto.Querier_TailClient, error) {
clients, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
resps, err := q.forAllIngesters(ctx, func(client logproto.QuerierClient) (interface{}, error) {
return client.Tail(ctx, req)
})
if err != nil {
return nil, err
}

tailClients := make(map[string]logproto.Querier_TailClient)
for i := range clients {
tailClients[clients[i].addr] = clients[i].response.(logproto.Querier_TailClient)
for i := range resps {
tailClients[resps[i].addr] = resps[i].response.(logproto.Querier_TailClient)
}

return tailClients, nil
Expand Down

0 comments on commit 0986d8d

Please sign in to comment.