Skip to content

Commit

Permalink
fix: redundant loop and nil check filterer
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Aug 26, 2024
1 parent b278765 commit a0a429d
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,10 @@ func (i *TSDBIndex) Stats(ctx context.Context, _ string, from, through model.Tim
by := make(map[string]struct{})
if i.chunkFilter != nil {
filterer = i.chunkFilter.ForRequest(ctx)
for _, k := range i.chunkFilter.ForRequest(ctx).RequiredLabelNames() {
by[k] = struct{}{}
if filterer != nil {
for _, k := range filterer.RequiredLabelNames() {
by[k] = struct{}{}
}
}
}
for p.Next() {
Expand Down Expand Up @@ -368,9 +370,6 @@ func (i *TSDBIndex) Volume(
for k := range labelsToMatch {
by[k] = struct{}{}
}
for _, k := range targetLabels {
by[k] = struct{}{}
}

// If we are aggregating by series, we need to include all labels in the series required for filtering chunks.
if i.chunkFilter != nil {
Expand Down

0 comments on commit a0a429d

Please sign in to comment.