Skip to content

feat: add three-way ad-hoc filters mode (extra_filters, root query, off)#634

Open
edspc wants to merge 1 commit intoVictoriaMetrics:mainfrom
edspc:disable_ad_hoc_filters
Open

feat: add three-way ad-hoc filters mode (extra_filters, root query, off)#634
edspc wants to merge 1 commit intoVictoriaMetrics:mainfrom
edspc:disable_ad_hoc_filters

Conversation

@edspc
Copy link
Copy Markdown

@edspc edspc commented May 4, 2026

Related issue: #633

Describe Your Changes

Replace the binary "Ad-hoc filters to root query" toggle with a three-option selector so users can disable automatic ad-hoc filter injection entirely. This prevents double-filtering when users manage ad-hoc values through Grafana variable interpolation and avoids silent empty results when filtering on pipe-transformed fields.

Checklist

The following checks are mandatory:


Summary by cubic

Adds a three-option “Ad‑hoc filters” mode (Extra Filters, Root Query, Off) to replace the old toggle. This lets users disable automatic injection to avoid double-filtering and empty results when using pipes or variable interpolation. Related to #633.

  • New Features

    • New adHocFiltersMode on queries with extraFilters, rootQuery, off; legacy isApplyExtraFiltersToRootQuery is still honored via resolveAdHocFiltersMode.
    • Query Editor now shows a radio selector and displays the selected mode in the collapsed summary.
    • Datasource behavior by mode:
      • Extra Filters: send as extra_filters.
      • Root Query: prepend to expr, clear extraFilters.
      • Off: do not inject ad‑hoc filters.
    • Tests updated/added for all modes and legacy fallback.
  • Migration

    • Existing queries keep their behavior: default to Extra Filters unless the legacy flag is true (then Root Query).
    • If you manage filters via Grafana variables, set mode to Off to prevent duplicates.

Written for commit 911a4e0. Summary will update on new commits.

…ff) (VictoriaMetrics#633)

Replace the binary "Ad-hoc filters to root query" toggle with a three-option selector so users can disable automatic ad-hoc filter injection entirely. This prevents double-filtering when users manage ad-hoc values through Grafana variable interpolation and avoids silent empty results when filtering on pipe-transformed fields.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant