grafana/public/app/features/expressions
Yuri Tseretyan f6a46744a6
Alerting: Support hysteresis command expression (#75189)
Backend: 

* Update the Grafana Alerting engine to provide feedback to HysteresisCommand. The feedback information is stored in state.Manager as a fingerprint of each state. The fingerprint is persisted to the database. Only fingerprints that belong to Pending and Alerting states are considered as "loaded" and provided back to the command.
   - add ResultFingerprint to state.State. It's different from other fingerprints we store in the state because it is calculated from the result labels.
  -  add rule_fingerprint column to alert_instance
   - update alerting evaluator to accept AlertingResultsReader via context, and update scheduler to provide it.
   - add AlertingResultsFromRuleState that implements the new interface in eval package
   - update getExprRequest to patch the hysteresis command.

* Only one "Recovery Threshold" query is allowed to be used in the alert rule and it must be the Condition.


Frontend:

* Add hysteresis option to Threshold in UI. It's called "Recovery Threshold"
* Add test for getUnloadEvaluatorTypeFromCondition
* Hide hysteresis in panel expressions

* Refactor isInvalid and add test for it
* Remove unnecesary React.memo
* Add tests for updateEvaluatorConditions

---------

Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
2024-01-04 11:47:13 -05:00
..
components Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
utils Alerting: Add default input parameters for expressions (#51810) 2022-07-12 11:50:58 +02:00
ExpressionDatasource.test.ts Chore: fix type errors in tests (#63270) 2023-02-14 16:46:42 +01:00
ExpressionDatasource.ts Chore: improve types (#78126) 2023-11-16 12:39:12 +00:00
ExpressionQueryEditor.tsx Fix width for Resample label (#71011) 2023-07-04 14:34:47 +02:00
guards.ts Alerting: Fix queries not being previewed in detail view (#64198) 2023-03-06 15:46:55 +01:00
types.ts Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00