-
Notifications
You must be signed in to change notification settings - Fork 808
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
Add LabelNamesForMetricName for the series store #1346
Add LabelNamesForMetricName for the series store #1346
Conversation
/cc @gouthamve @jtlisi |
ebb2661
to
d6f9991
Compare
Seems kinda gross 😬 Back with the code as you have it, it may be worthwhile to pass a hint down to the DB interface that you only want one chunk, and/or avoid reading the same series across multiple day buckets. |
d6f9991
to
a4dd657
Compare
So I tried another implementation, I'm fetching all index but only one chunk per metric fingerprint. I had to create two implementation to make it works (series+chunk store) |
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
a4dd657
to
813c1b8
Compare
I've rebased my branch, I think this is good to go. @gouthamve @tomwilkie @jtlisi @cstyan : I would really love to get that fix for Loki, been sitting here for a month already. |
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.
just a few comments, don't know enough about the chunk storage to 👍 though
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
please @tomwilkie @bboreham would you be able to take a look ? From my point of view this is good to go. |
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.
Seems ok. I'm a bit disappointed with the amount of repetition, but it isn't obviously easy to refactor.
Did worry about the efficiency of dedupe.
pkg/chunk/chunk_store.go
Outdated
return nil, err | ||
} | ||
var result []string | ||
for _, c := range allChunks { |
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.
This bit seems likely to be inefficient - most chunks will have the same label names, but potentially thousands of unique fingerprints, so you will add thousands of copies of the same string then sort them then dedupe them.
Suggest using a map
instead.
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.
actuallyI'm only fetching a single chunk per unique fingerprints 257:
filtered, keys := filterChunksByUniqueFingerprint(filtered)
but you're right unique fingerprint can have many label name duplicate. I'll improve this.
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.
Voila !
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
LGTM from me! |
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!
This adds LabelNamesForMetricName for the series store only, I wanted to first get your feedback if this seems correct.
I would like a special attention to that lookupSingleChunkBySeries and its usage, not sure if this is the right way to approach the problem. (May be I should loop though queries and entries until I get a result ?)
I still need to implement this for the chunk store but I'm not sure what would be the most efficient way of doing this.
The PR is rebased on my other work to include the split of the time range validation. So don't mind the two other commit they won't be part of this PR.
Thank you !