Skip to content

Conversation

@yeya24
Copy link
Contributor

@yeya24 yeya24 commented Oct 26, 2025

What this PR does:

image

In ingester, we are seeing about 9.2% of allocations in labels.Labels.WithoutEmpty when appending series to TSDB. If there is any label with empty value, a new label slice is allocated to exclude empty value labels. https://github.com/prometheus/prometheus/blob/817dde743c280f3364c5ecb127cf38a26298198c/model/labels/labels_slicelabels.go#L241

This allocation is unnecessary and can cause more frequent GC. One way to improve is to filter out empty label value in the distributor to avoid more work on the Ingester hot path.

Note that filtering out empty values won't change how the series is sharded as we also filter out empty value in the sharding key. #5717

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@yeya24 yeya24 force-pushed the filter-out-empty-label-ingester branch from 3c9f58a to b516e13 Compare October 27, 2025 07:24
@SungJin1212
Copy link
Member

Nice improvements

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 27, 2025
@yeya24 yeya24 force-pushed the filter-out-empty-label-ingester branch from b516e13 to f9674fc Compare October 27, 2025 18:09
@alanprot
Copy link
Member

Nice! thanks

@yeya24 yeya24 merged commit db252aa into cortexproject:master Oct 27, 2025
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/distributor lgtm This PR has been approved by a maintainer size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants