Skip to content

Commit

Permalink
Use cached label sets (thanos-io#7420)
Browse files Browse the repository at this point in the history
The distributed engine retrieves label sets once per query, and
doing the expensive copying and conversion uses a lot of memory.

We already set them in the format we need in the endpoint status,
so we can retrieve them from there.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski authored and hczhu-db committed Aug 22, 2024
1 parent 72fe738 commit 6914528
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/query/endpointset.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ func (e *EndpointSet) GetStoreClients() []store.Client {
metadata: er.metadata,
groupKey: er.GroupKey(),
replicaKey: er.ReplicaKey(),
status: er.status,
})
er.mtx.RUnlock()
}
Expand Down Expand Up @@ -913,7 +914,7 @@ func (er *endpointRef) LabelSets() []labels.Labels {
er.mtx.RLock()
defer er.mtx.RUnlock()

return er.labelSets()
return er.status.LabelSets
}

func (er *endpointRef) labelSets() []labels.Labels {
Expand Down

0 comments on commit 6914528

Please sign in to comment.