-
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
Flag to add active query tracker. #5555
Conversation
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.
Love this change. LGTM.
Fixes part of #5521
For this pr, I feel it is good to fix 5521. If you plan to also add the UI part of the active queries I would say let's do it in another PR.
Let's also fix docs and add a changelog entry
Thanks @yeya24 :) Looking into how I can fix this failing test. |
954d3bb
to
9763d25
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.
Thanks for awesome work! This would be awesome to have! 🌟
Some tiny suggestions to fix CI!
test/e2e/e2ethanos/services.go
Outdated
@@ -345,6 +345,9 @@ func (q *QuerierBuilder) collectArgs() ([]string, error) { | |||
|
|||
args = append(args, "--store.sd-files="+filepath.Join(q.InternalDir(), "filesd.yaml")) | |||
} | |||
|
|||
args = append(args, "--query.active-query-path="+q.InternalDir()) |
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.
So this breaks a test, specifically the TestQueryCompatibilityWithPreInfoAPI
e2e test, reason being that we use specific images for the test cases on that one here. The new -query.active-query-path
flag won't exist on any image but the latest, so this cannot be an always-enabled option. 🙂
Maybe you can address @GiedriusS's comment and make the flag optional, and add a new WithActiveQueryTracker
method on QuerierBuilder
and use that instead in a dedicated e2e test which checks for this file?
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.
So from my attempts at an E2E test, I think the same issues that plagued this PR during CI will occur during an E2E test. The issue I'm referring to is related to container permissions and seems to be a known issue: prometheus/prometheus#5976.
Is there any alternative way I could try?
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.
After making this flag optional in E2E and add WithActiveQueryTracker then you should be good.
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've pushed a draft of the test I created and I have added these but I still face an issue.
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.
Yes, what I think you could do is maybe execute a command, to change permissions for the data dir, as mentioned in 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.
It might be a bit too difficult to make it work in an e2e setup, so I think it would be fine to skip an e2e test for this. But maybe you can document this issue in Querier docs instead? So users are aware of the implications of using this! 🙂
d2fdcf7
to
9efc71e
Compare
@metonymic-smokey I think this feature is ready for merge now. Can you please mark it as ready for review? |
9efc71e
to
1fa3848
Compare
@yeya24 marked it as ready, but I think I need to add an E2E test right? |
Yeah, please add it. |
1fa3848
to
b19e03e
Compare
b19e03e
to
2e0348e
Compare
2e0348e
to
a3cb06f
Compare
@GiedriusS @yeya24 pls take a final look at this when you're free :) |
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.
We should also pass the parameter here. That code creates different engines for different lookback deltas depending on the parameters. Thus, I suggest creating subdirectories like raw
, 5m
and 1h
for the different engines in the provided directory. Maybe you could even move the creation of the ActiveQueryTracker
to that function because you will possibly need to create multiple trackers
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
a3cb06f
to
aac92ec
Compare
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
aac92ec
to
140fec1
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 work! LGTM!
8b292ec
to
b692b30
Compare
resActiveQueryDir := filepath.Join(activeQueryDir, getActiveQueryDirBasedOnResolution(r)) | ||
newEngineOpts.ActiveQueryTracker = promql.NewActiveQueryTracker(resActiveQueryDir, maxConcurrentQueries, logger) | ||
} else { | ||
newEngineOpts.ActiveQueryTracker = eo.ActiveQueryTracker |
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.
Do we need this else
block? If activeQueryDir
is empty string then the ActiveQueryTracker
is just nil if I understand correctly
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.
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.
Let's remove it to avoid confusion.
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.
Or you could add a comment about it is nil.
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, done.
If possible could you please retrigger the CI tests once again?
Thanks!
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
59cd803
to
42913d7
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.
LGTM. Thanks for the great work!
Signed-off-by: Aditi Ahuja ahuja.aditi@gmail.com
Fixes #5521
Changes
Added a new flag which creates a
query.active
file in the filepath specified by the flag.Verification