Query: allow multiple deduplication label.#1362
Conversation
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
fd3d893 to
707eca9
Compare
povilasv
left a comment
There was a problem hiding this comment.
Nice work 🥇 don't really have anything to comment on :D
Would be great if somebody else would also take a look.
brancz
left a comment
There was a problem hiding this comment.
Generally this looks like the right direction, just confirming two things.
pkg/query/iter.go
Outdated
| 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.
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.
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.
bwplotka
left a comment
There was a problem hiding this comment.
Nice! Thanks for detailed tests and doc improvements.
Some suggestions and inconsistencies, otherwise LGTM
pkg/query/iter.go
Outdated
| 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 { |
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
42c98d9 to
35ac58b
Compare
bwplotka
left a comment
There was a problem hiding this comment.
Awesome! I think this make sense.
There is a bug (type) but otherwise LGTM! (: Thanks and sorry for delay.
| const partialResponseParam = "partial_response" | ||
| enablePartialResponse = api.enablePartialResponse | ||
|
|
||
| // Overwrite the cli flag when provided as a query parameter. |
There was a problem hiding this comment.
Did you mean to put this below?
There was a problem hiding this comment.
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.
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.
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.
Nice, that might work nicely 👍
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
ab5488b to
bf7e0f5
Compare
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
34f3aed to
b22f7b8
Compare
Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
b22f7b8 to
b8cd889
Compare
|
Looks like netlify OOMs (: https://app.netlify.com/sites/thanos-io/deploys/5d7f620fb4a56e00093ad620 |
| const partialResponseParam = "partial_response" | ||
| enablePartialResponse = api.enablePartialResponse | ||
|
|
||
| // Overwrite the cli flag when provided as a query parameter. |
There was a problem hiding this comment.
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 <8903888+krasi-georgiev@users.noreply.github.com>
Closes: #1174
Changes
Can start the querier with multi replica labels like:
querier api supports
replicaLabelsurl param which will overwrite the--query.replica-labelcli flag to allow dynamic deduplication at query time.