Skip to content

Parameterize lookback in PromQL #3453

@waynexia

Description

@waynexia

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions