-
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
Query: allow multiple deduplication label. #1362
Query: allow multiple deduplication label. #1362
Conversation
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
fd3d893
to
707eca9
Compare
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.
Nice work 🥇 don't really have anything to comment on :D
Would be great if somebody else would also take a look.
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.
Generally this looks like the right direction, just confirming two things.
pkg/query/iter.go
Outdated
@@ -325,10 +325,10 @@ func (s *dedupSeriesSet) Next() bool { | |||
// replica label if it exists | |||
func (s *dedupSeriesSet) peekLset() labels.Labels { | |||
lset := s.peek.Labels() | |||
if lset[len(lset)-1].Name != s.replicaLabel { | |||
if _, ok := s.replicaLabels[lset[len(lset)-1].Name]; !ok { |
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.
I would have expected that we need to verify each replica label here. I feel like I'm missing something about this logic though, can you explain what's happening here?
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.
If the last label is not in the replicaLabels
list than no replica labels are set.
Replica labels are always at the end of the list so if the last one is not present in the s.replicaLabels
map this guarantees that no replica labels need to be stripped.
If the last labels in the full list is a replica label than strip all replica labels by removing len(s.replicaLabels)
labels from the full labels list.
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.
Worth to comment this indeed.
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.
Nice! Thanks for detailed tests and doc improvements.
Some suggestions and inconsistencies, otherwise LGTM
pkg/query/iter.go
Outdated
@@ -325,10 +325,10 @@ func (s *dedupSeriesSet) Next() bool { | |||
// replica label if it exists | |||
func (s *dedupSeriesSet) peekLset() labels.Labels { | |||
lset := s.peek.Labels() | |||
if lset[len(lset)-1].Name != s.replicaLabel { | |||
if _, ok := s.replicaLabels[lset[len(lset)-1].Name]; !ok { |
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.
Worth to comment this indeed.
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
42c98d9
to
35ac58b
Compare
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.
Awesome! I think this make sense.
There is a bug (type) but otherwise LGTM! (: Thanks and sorry for delay.
@@ -212,6 +230,7 @@ func (api *API) parsePartialResponseParam(r *http.Request) (enablePartialRespons | |||
const partialResponseParam = "partial_response" | |||
enablePartialResponse = api.enablePartialResponse | |||
|
|||
// Overwrite the cli flag when provided as a query parameter. |
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.
Did you mean to put this below?
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.
Anyway I would be fine with just what we have in doc, so maybe we can drop this comment?
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.
No this is the right place and it is for the partialResponseParam
I prefer to keep the comment here as I was a bit confused why this is done this way when I first saw it.
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.
Why you put it here then and not for parseDownsamplingParamMillis
and parseReplicaLabelsParam
? I don't get it ):
// Check how many replica labels are present so that these are removed. | ||
var totalToRemove int | ||
for index := 0; index < len(s.replicaLabels); index++ { | ||
if _, ok := s.replicaLabels[lset[len(lset)-index-1].Name]; ok { |
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.
Nice, that might work nicely 👍
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
ab5488b
to
bf7e0f5
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
bf7e0f5
to
5c4ae8c
Compare
34f3aed
to
b22f7b8
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
b22f7b8
to
b8cd889
Compare
Looks like netlify OOMs (: https://app.netlify.com/sites/thanos-io/deploys/5d7f620fb4a56e00093ad620 |
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.
LGTM!
Thanks!
@@ -212,6 +230,7 @@ func (api *API) parsePartialResponseParam(r *http.Request) (enablePartialRespons | |||
const partialResponseParam = "partial_response" | |||
enablePartialResponse = api.enablePartialResponse | |||
|
|||
// Overwrite the cli flag when provided as a query parameter. |
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.
Why you put it here then and not for parseDownsamplingParamMillis
and parseReplicaLabelsParam
? I don't get it ):
I see what you mean now , yes that would be better to be as a comment to the function itself. If I don't forget will open a PR. |
Signed-off-by: Krasi Georgiev <[email protected]>
Closes: #1174
Changes
Can start the querier with multi replica labels like:
querier api supports
replicaLabels
url param which will overwrite the--query.replica-label
cli flag to allow dynamic deduplication at query time.