Skip to content

PromQL planner omits topk over temporal aggregations #699

Description

@milindsrivastava1997

Problem

Valid PromQL expressions that apply topk to a temporal aggregation are not represented in the generated planner output and cannot be served by ASAPQuery.

Affected expressions include:

topk(1, sum_over_time(data[5m]))
topk by (job) (3, count_over_time(data[5m]))

The planner recognizes topk when its operand is a raw vector selector. Its spatial-over-temporal query patterns cover a limited set of other aggregation operators but do not include topk. As a result, these queries are omitted from inference_config.yaml even though the underlying temporal expressions are planned.

Observed behavior

All 24 topk-over-temporal queries in the aggregations differential suite fail for both range and instant evaluation.

DEBUG logs report:

query=topk(1, sum_over_time(data[5m])) destination=none_unsupported

Because unsupported-query forwarding is disabled in the differential configuration, the public response is:

bad_data: No result for query

The generated inference configuration contains entries for sum_over_time(data[5m]) and count_over_time(data[5m]), but none of the surrounding topk expressions.

Impact

ASAPQuery cannot answer this class of valid PromQL queries locally. The failure is surfaced as a generic missing-result error rather than identifying the unsupported query shape.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions