Skip to content

Conversation

@lamida
Copy link
Contributor

@lamida lamida commented Dec 10, 2025

https://github.com/grafana/mimir-squad/issues/3280

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]. If changelog entry is not needed, please add the changelog-not-needed label to the PR.
  • about-versioning.md updated with experimental features.

Comment on lines +1020 to 1034
duplicated, limitErr := queryLimiter.AddSeries(ls)
if limitErr != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, limitErr
}

if duplicated {
continue
}

// TODO move this inside AddSeries
if err := memoryTracker.IncreaseMemoryConsumptionForLabels(ls); err != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, err
}

myStreamingSeriesLabels = append(myStreamingSeriesLabels, ls)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
duplicated, limitErr := queryLimiter.AddSeries(ls)
if limitErr != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, limitErr
}
if duplicated {
continue
}
// TODO move this inside AddSeries
if err := memoryTracker.IncreaseMemoryConsumptionForLabels(ls); err != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, err
}
myStreamingSeriesLabels = append(myStreamingSeriesLabels, ls)
ls, limitErr := queryLimiter.AddSeries(ls)
if limitErr != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, limitErr
}
// TODO move this inside AddSeries
if err := memoryTracker.IncreaseMemoryConsumptionForLabels(ls); err != nil {
return myWarnings, myQueriedBlocks, myStreamingSeriesLabels, indexBytesFetched, false, false, err
}
myStreamingSeriesLabels = append(myStreamingSeriesLabels, ls)

defer ql.uniqueSeriesMx.Unlock()

uniqueSeriesBefore := len(ql.uniqueSeries)
_, duplicated := ql.uniqueSeries[fingerprint]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_, duplicated := ql.uniqueSeries[fingerprint]
seriesLabels, duplicated := ql.uniqueSeries[fingerprint]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thing we should do here: we'll need to handle hash collisions.

}

return NewMaxSeriesHitLimitError(uint64(ql.maxSeriesPerQuery))
return duplicated, NewMaxSeriesHitLimitError(uint64(ql.maxSeriesPerQuery))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return duplicated, NewMaxSeriesHitLimitError(uint64(ql.maxSeriesPerQuery))
return seriesLabels, NewMaxSeriesHitLimitError(uint64(ql.maxSeriesPerQuery))

return duplicated, NewMaxSeriesHitLimitError(uint64(ql.maxSeriesPerQuery))
}
return nil
return duplicated, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return duplicated, nil
return seriesLabels, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants