[fix] evaluate threshold rules with empty field values - #4307
Open
orangeCatDeveloper wants to merge 1 commit into
Open
[fix] evaluate threshold rules with empty field values#4307orangeCatDeveloper wants to merge 1 commit into
orangeCatDeveloper wants to merge 1 commit into
Conversation
Strict jexl throws on undefined variables, so a row with an empty string field (e.g. fullsite errorMsg on healthy pages) aborted the whole rule and the alert never fired (apache#1562, regression from apache#1478). Define every field: strings keep their value, unparseable number/time become null, matching the existing NULL_VALUE semantics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
Fixes #1562: threshold rules referencing a sometimes-empty field (e.g. fullsite
errorMsg) never fire.JEXL runs with
strict(true)and throws on undefined variables, but the calculator skipped empty values when building the per-row variable map — so the whole rule aborted on every row whereerrorMsgwas"", including the non-2xx rows it should have caught (regression from #1478, carried through #1859/#2902 with changing error text).Fix: always define every field — strings keep their value (including
""), unparseable number/time becomenull, same as the existingNULL_VALUEhandling. The expression functions (contains/matches/equals/exists) are already null-safe.Not covered: the zero-row empty-sitemap case (needs a collector-side decision) and the Firefox editor freeze from the issue (frontend).
Before/after with the issue's exact rule against a sitemap containing one 404 page:
Checklist
Add or update API