Skip to content

[fix] evaluate threshold rules with empty field values - #4307

Open
orangeCatDeveloper wants to merge 1 commit into
apache:masterfrom
orangeCatDeveloper:fix/1562-undefined-expr-field
Open

[fix] evaluate threshold rules with empty field values#4307
orangeCatDeveloper wants to merge 1 commit into
apache:masterfrom
orangeCatDeveloper:fix/1562-undefined-expr-field

Conversation

@orangeCatDeveloper

@orangeCatDeveloper orangeCatDeveloper commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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 where errorMsg was "", 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 become null, same as the existing NULL_VALUE handling. 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:

before: no alert; each cycle logs "Run Error: ... variable 'errorMsg' is undefined"
after:  no errors; alert fires: "site page down: http://.../missing.html status 404"

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] <SiteMap threshold alarm error>

1 participant