Skip to content

Query engine cannot distinguish occurrences of the same query string with different requirements #778

Description

@milindsrivastava1997

Problem

The same PromQL leaf query string can show up more than once in a workload, each time with different requirements. For example:

  • It is issued at different intervals (different repetition_delay_ms).
  • It runs on its own in one place and as a sub-expression of a larger query in another.
  • The occurrences have different accuracy_sla / latency_sla.

The planner can treat these as separate items with separate requirements; since #776, the optimizer key includes t_repeat_ms and both SLAs. That can lead to more than one deployed sketch backing the same query string.

The query engine has no way to tell these occurrences apart when a query arrives. It looks up the QueryConfig by query string alone and uses the first match:

  • asap-query-engine/src/engines/simple_engine/mod.rs:576 (find_query_config)
  • asap-query-engine/src/engines/simple_engine/promql.rs:238 (find_query_config_promql_structural)

So when several QueryConfig entries share a query string:

  • Only the first one is ever used to answer queries. Other sketches are still ingested and stored, but never queried.
  • An occurrence with a strict SLA may be answered by a sketch sized for a relaxed SLA, or one built for a different cadence.
  • Which entry wins depends on the order of query_configs, which the planner does not guarantee to be stable.

To investigate

  • How the workload, planner and engine should identify a query occurrence beyond its string (cadence, SLA, standalone vs. nested).
  • Whether the problem appears today in realistic workloads, and how often.

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions