redash
redash copied to clipboard
Fix alert evaluation logic and issue with calculating min and max for alerts
What type of PR is this?
- [ ] Refactor
- [ ] Feature
- [x] Bug Fix
- [ ] New Query Runner (Data Source)
- [ ] New Alert Destination
- [ ] Other
Description
Currently, if op(value, threshold) is not True, the alert evaluates to OK_STATE. This happens in situations where you have op = <, value = "test", and threshold = 4. Since this isn't a logical evaluation, I propose that we evaluate the alert to UNKNOWN_STATE in situations like these.
Additionally, when calculating the minimum and maximum of a column, there is no check for whether the column values are numbers. This PR adds that check in and evaluates the alert to UNKNOWN_STATE if the data in the column cannot be converted to numbers (meaning we can't logically evaluate the minimum or maximum of the column).
How is this tested?
- [x] Unit tests (pytest, jest)
- [ ] E2E Tests (Cypress)
- [ ] Manually
- [ ] N/A
Related Tickets & Documents
#7076