Skip to content

Reduce the number of series that are kept in memory while streaming from ingesters #4745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* [BUGFIX] Distributor: Fix a memory leak in distributor due to the cluster label. #4739
* [ENHANCEMENT] Compactor: uploading blocks no compaction marks to the global location and introduce a new metric #4729
* `cortex_bucket_blocks_marked_for_no_compaction_count`: Total number of blocks marked for no compaction in the bucket.
* [ENHANCEMENT] Querier: Reduce the number of series that are kept in memory while streaming from ingesters. #4745

## 1.11.0 2021-11-25

Expand Down
6 changes: 6 additions & 0 deletions pkg/cortexpb/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ func FromLabelAdaptersToMetric(ls []LabelAdapter) model.Metric {
return util.LabelsToMetric(FromLabelAdaptersToLabels(ls))
}

// FromLabelAdaptersToMetric converts []LabelAdapter to a model.Metric with copy.
// Don't do this on any performance sensitive paths.
func FromLabelAdaptersToMetricWithCopy(ls []LabelAdapter) model.Metric {
return util.LabelsToMetric(FromLabelAdaptersToLabelsWithCopy(ls))
}

// FromMetricsToLabelAdapters converts model.Metric to []LabelAdapter.
// Don't do this on any performance sensitive paths.
// The result is sorted.
Expand Down
2 changes: 1 addition & 1 deletion pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ func (d *Distributor) MetricsForLabelMatchersStream(ctx context.Context, from, t
}

for _, metric := range resp.Metric {
m := cortexpb.FromLabelAdaptersToMetric(metric.Labels)
m := cortexpb.FromLabelAdaptersToMetricWithCopy(metric.Labels)

if err := queryLimiter.AddSeries(cortexpb.FromMetricsToLabelAdapters(m)); err != nil {
return nil, err
Expand Down