grafana/pkg/services/ngalert/state
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
..
historian Alerting: Don't record annotations for mapped NoData transitions, when NoData is mapped to OK (#77164) 2023-12-18 16:59:32 -05:00
template Chore: Upgrade Go to 1.21.3 (#77304) 2023-11-01 09:17:38 -07:00
cache_bench_test.go Alerting: Improve performance of cache.getOrCreate (#63909) 2023-06-15 09:37:47 -04:00
cache_test.go Chore: Replace go-multierror with errors package (#66432) 2023-06-19 12:29:45 +03:00
cache.go Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
compat_test.go Alerting: Use only token for images in notifications (#70196) 2023-06-21 20:53:45 -03:00
compat.go Alerting: Use only token for images in notifications (#70196) 2023-06-21 20:53:45 -03:00
image_mock.go Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
manager_bench_test.go Alerting: Make alert state history Loki http client public (#78291) 2023-11-27 09:20:50 -05:00
manager_private_test.go Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
manager_test.go Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
manager.go Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
persist.go Alerting: Remove and revert flag alertingBigTransactions (#65976) 2023-04-06 18:06:25 +02:00
state_test.go Alerting: Allow more time before Alertmanager expire-resolves alerts (#77094) 2023-10-25 10:03:46 -05:00
state.go Alerting: Support hysteresis command expression (#75189) 2024-01-04 11:47:13 -05:00
testing.go Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00