Skip to content

refactor(query-engine): classify no-local-data separately from native failures #748

Description

@milindsrivastava1997

Goal

Represent a recognized PromQL query with no locally precomputed output as an explicit query-execution outcome, rather than overloading Ok(None).

Context

Issue #747 changes the public PromQL entry points to Result<Option<...>, QueryExecutionError>. For compatibility, #747 will continue to use Ok(None) when local precomputed data is absent, so the HTTP layer can fall back to Prometheus.

Architecturally, the absence of local data is distinct from both an unsupported query and a broken native execution. It should be observable as a typed outcome while retaining its intentional fallback behavior.

Scope

  • Add a distinct, actionable QueryExecutionError variant (for example, NoLocalData) for a query that was recognized locally but has no eligible precomputed output.
  • Return that variant from the appropriate native execution path(s), without conflating it with invalid plans, store failures, or operator failures.
  • Update the HTTP routing policy so it falls back to Prometheus only for the explicit no-local-data variant.
  • Keep invalid plans, store failures, and operator failures local errors with no fallback.
  • Add public-method and HTTP tests proving all three cases: unsupported/malformed PromQL, no local data, and genuine native execution failure.

Non-goals

Acceptance criteria

  • A recognized query with no local precomputed output reaches the configured fallback backend.
  • An unsupported or malformed query retains the existing capability-miss behavior.
  • A native invalid-plan, store, or operator failure returns a local error and never calls the fallback backend.
  • Direct Rust callers can distinguish no-local-data from a genuine native execution failure.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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