-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Filter external labels from matchers on LabelValues/LabelNames #5596
Conversation
Signed-off-by: Oron Sharabi <[email protected]>
dea5e79
to
02dfb61
Compare
Signed-off-by: Oron Sharabi <[email protected]>
eaeb528
to
893ba45
Compare
Fixes issue #5577 |
Signed-off-by: Oron Sharabi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job and idea, thanks! 💪🏽
Do you mind re-shaping comments to be compatible with our Go guide?
pkg/store/bucket.go
Outdated
@@ -1254,6 +1254,11 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq | |||
if len(reqBlockMatchers) > 0 && !b.matchRelabelLabels(reqBlockMatchers) { | |||
continue | |||
} | |||
// filter ext labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have comments as full sentences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/store/bucket.go
Outdated
@@ -1341,6 +1346,25 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq | |||
}, nil | |||
} | |||
|
|||
func (b *bucketBlock) FilterExtLabelsMatchers(matchers []*labels.Matcher) ([]*labels.Matcher, bool) { | |||
// we filter external labels from matchers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditoo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Oron Sharabi <[email protected]>
Thanks for the review @bwplotka ! fixed comments :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪🏽
Thanks! |
…s-io#5596) * Filter external labels from matchers on LabelValues/LabelNames Signed-off-by: Oron Sharabi <[email protected]> * Fix linting Signed-off-by: Oron Sharabi <[email protected]> * Fix linter Signed-off-by: Oron Sharabi <[email protected]> * Fix comments to be full Sentences Signed-off-by: Oron Sharabi <[email protected]> Signed-off-by: Oron Sharabi <[email protected]>
Changes
Filter external labels from matchers in
LabelValues
andLabelNames
rpcs.We noticed super high memory spikes in
storegateway
for the label apis and noticed that if there're matchers store will try to fetch series for postings.When using
prom-label-proxy
to enforcetenant_id
label for example, it's propagating to matchers and so going to slow path, sincetenant_id
or any other external label is only presented onmeta.json
, all series would have to be fetched resulting in huge memory spikes (~50Gb and more).By filtering external labels from matchers we ensure this won't happen and also filtering the blocks that have those external labels but with different values.
Tested locally and it solved the issue.
Verification