Skip to content

fix(store): correct no-op slice element removal in matchesExternalLabels - #8927

Open
magic-peach wants to merge 1 commit into
thanos-io:mainfrom
magic-peach:fix/slice-remove-noop
Open

fix(store): correct no-op slice element removal in matchesExternalLabels#8927
magic-peach wants to merge 1 commit into
thanos-io:mainfrom
magic-peach:fix/slice-remove-noop

Conversation

@magic-peach

Copy link
Copy Markdown

Summary

  • Fix no-op slice element removal in matchesExternalLabels in store and exemplars packages

Bug

append(tms[:i], tms[i:]...) is a no-op — it reconstructs the same slice without removing element at index i. The correct expression is append(tms[:i], tms[i+1:]...). This bug exists in both pkg/store/prometheus.go and pkg/exemplars/proxy.go.

Fix

Change tms[i:]... to tms[i+1:]... in both files.

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>

@GiedriusS GiedriusS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add unit tests for this case?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants