Skip to content
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

Parameterize lookback in PromQL #3453

Closed
waynexia opened this issue Mar 7, 2024 · 7 comments
Closed

Parameterize lookback in PromQL #3453

waynexia opened this issue Mar 7, 2024 · 7 comments
Assignees
Labels
C-user-experience Category User Experience good first issue Good for newcomers

Comments

@waynexia
Copy link
Member

waynexia commented Mar 7, 2024

What problem does the new feature solve?

Prometheus now supports to set lookback per query prometheus/prometheus#9946

In our framework, this parameter is defaulted to 5m and can't be overridden per query at present

const DEFAULT_LOOKBACK: u64 = 5 * 60; // 5m
pub const DEFAULT_LOOKBACK_STRING: &str = "5m";

But the underlying planner does have a parameter

struct PromPlannerContext {
// query parameters
start: Millisecond,
end: Millisecond,
interval: Millisecond,
lookback_delta: Millisecond,

What does the feature do?

Support setting lookback per query as well.

Prometheus hasn't exposed this to HTTP API, so we only need to change the TQL part for now.

Specifically, makes TQL accept the new fourth optional parameter for lookback and handle it in the planner:

TQL EVAL (<start>, <end>, <step>, [lookback]) <promql>

Implementation challenges

No response

@waynexia waynexia added the C-user-experience Category User Experience label Mar 7, 2024
@yuanbohan
Copy link
Contributor

yuanbohan commented Mar 13, 2024

With this feature, we can have the ability to use PromQL to query exact data with no false result via setting lookback_delta=0, exciting 🚀

@etolbakov
Copy link
Collaborator

etolbakov commented Mar 15, 2024

I don’t want to overcommit but ideally I’d like to do this one as well.
As a part of #3452 I’m changing the Tql query parsing (#3507)

@tisonkun
Copy link
Collaborator

@etolbakov Cool! Feel free to link this issue in your PR like closes #3453.

@tisonkun
Copy link
Collaborator

@waynexia BTW I wonder what is the difference between the code path of PromQL and TQL. Seems it's quite a bit undocumented.

@waynexia
Copy link
Member Author

This is not part of #3492.

what is the difference between the code path of PromQL and TQL

They are the same after parser phase

@tisonkun
Copy link
Collaborator

Is this closed by #3630?

cc @etolbakov @waynexia

@etolbakov
Copy link
Collaborator

yeah, let's close it @tisonkun
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-user-experience Category User Experience good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants