Skip to content

Do deep validation for filter policies in user configurable overrides API#6407

Merged
electron0zero merged 4 commits intografana:mainfrom
electron0zero:validation_filter_polices
Feb 9, 2026
Merged

Do deep validation for filter policies in user configurable overrides API#6407
electron0zero merged 4 commits intografana:mainfrom
electron0zero:validation_filter_polices

Conversation

@electron0zero
Copy link
Copy Markdown
Member

@electron0zero electron0zero commented Feb 6, 2026

What this PR does:

Do deep validation for filter policies in overrides API so we don't allow invalid filter policies via the user-configurable-overrides API.

  • Moves ValidateFilterPolicies into the centralized generator/validation package, consistent with other generator config validators.

  • Switches from config.ValidateFilterPolicy (shallow structural check) to spanfilter.NewSpanFilter for full validation. The shallow check
    only verifies that include/exclude are present and match types are valid. NewSpanFilter additionally validates:

    • TraceQL identifier parsing
    • Attribute scope checks (only resource and span are supported, rejects event, link, instrumentation)
    • Regex pattern compilation
    • Intrinsic enum values (kind, status, name)
  • Adds test coverage for all validation paths through NewSpanFilter.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

move ValidateFilterPolicies into the centralized validation package,
consistent with other generator config validators.

Also added tests for all validation checks
@electron0zero electron0zero force-pushed the validation_filter_polices branch from 6cab845 to c12eedc Compare February 6, 2026 20:15
config.ValidateFilterPolicy only does shallow structural checks. NewSpanFilter
additionally validates traceql identifiers, attribute scopes, regex compilation,
and intrinsic enum values.

Also add test for the support scopes (only resources and span)
@electron0zero electron0zero changed the title move filter policy validation to generator/validation pkg Use deep validation for filter policies in overrides API Feb 6, 2026
@electron0zero electron0zero changed the title Use deep validation for filter policies in overrides API Do deep validation for filter policies in user configurable overrides API Feb 6, 2026
@electron0zero electron0zero merged commit d2362d0 into grafana:main Feb 9, 2026
23 checks passed
@electron0zero electron0zero deleted the validation_filter_polices branch February 9, 2026 15:11
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.

3 participants