Skip to content

PromQL: validate counter metric compatibility with functions in postAnalysisVerification#145547

Merged
felixbarny merged 5 commits intoelastic:mainfrom
felixbarny:promql-counter-validation
Apr 3, 2026
Merged

PromQL: validate counter metric compatibility with functions in postAnalysisVerification#145547
felixbarny merged 5 commits intoelastic:mainfrom
felixbarny:promql-counter-validation

Conversation

@felixbarny
Copy link
Copy Markdown
Member

Within-series functions like avg_over_time, delta, etc. do not support counter metrics in the current ES|QL implementation. Conversely, rate/increase/irate only accept counter metrics. Previously, these mismatches caused 5xx errors during translation (QlIllegalArgumentException). This change catches them early in postAnalysisVerification, producing clear user-facing errors.

  • Adds a CounterSupport enum to PromqlFunctionRegistry.FunctionDefinition that classifies each function as REQUIRED (counter-only), SUPPORTED (both), or UNSUPPORTED (non-counter only)
  • The validation only checks functions whose direct child is a RangeSelector, because InstantSelectors are implicitly wrapped in LastOverTime during translation, which converts counter types to their numeric base types

…nalysisVerification

Within-series functions like avg_over_time, delta, etc. do not support counter
metrics in the current ES|QL implementation. Conversely, rate/increase/irate
only accept counter metrics. Previously, these mismatches caused 5xx errors
during translation (QlIllegalArgumentException). This change catches them
early in postAnalysisVerification, producing clear user-facing errors.

Adds a CounterSupport enum to PromqlFunctionRegistry.FunctionDefinition that
classifies each function as REQUIRED (counter-only), SUPPORTED (both), or
UNSUPPORTED (non-counter only). The validation only checks functions whose
direct child is a RangeSelector, because InstantSelectors are implicitly
wrapped in LastOverTime during translation, which converts counter types
to their numeric base types.
@felixbarny felixbarny added >non-issue external-contributor Pull request authored by a developer outside the Elasticsearch team Team:StorageEngine v9.4.0 :StorageEngine/PromQL PromQL support for Elastic labels Apr 2, 2026
@felixbarny felixbarny self-assigned this Apr 2, 2026
@felixbarny felixbarny requested review from kkrik-es and sidosera April 2, 2026 09:49
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@felixbarny felixbarny enabled auto-merge (squash) April 2, 2026 18:54
@felixbarny felixbarny merged commit 14a257f into elastic:main Apr 3, 2026
39 checks passed
@felixbarny felixbarny deleted the promql-counter-validation branch April 3, 2026 07:48
mromaios pushed a commit to mromaios/elasticsearch that referenced this pull request Apr 9, 2026
…nalysisVerification (elastic#145547)

Within-series functions like avg_over_time, delta, etc. do not support counter
metrics in the current ES|QL implementation. Conversely, rate/increase/irate
only accept counter metrics. Previously, these mismatches caused 5xx errors
during translation (QlIllegalArgumentException). This change catches them
early in postAnalysisVerification, producing clear user-facing errors.

Adds a CounterSupport enum to PromqlFunctionRegistry.FunctionDefinition that
classifies each function as REQUIRED (counter-only), SUPPORTED (both), or
UNSUPPORTED (non-counter only). The validation only checks functions whose
direct child is a RangeSelector, because InstantSelectors are implicitly
wrapped in LastOverTime during translation, which converts counter types
to their numeric base types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team >non-issue :StorageEngine/PromQL PromQL support for Elastic Team:StorageEngine v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants