Alerting/Annotations: Return nothing from Loki historian store if query type is annotation (#80742)

* Return empty slice if query type is `annotation`

* Add test + fix related test
This commit is contained in:
William Wernert
2024-01-18 11:39:33 -05:00
committed by GitHub
parent ded941eb84
commit e74313e171
2 changed files with 34 additions and 1 deletions
@@ -70,6 +70,10 @@ func NewLokiHistorianStore(cfg setting.UnifiedAlertingStateHistorySettings, ft f
}
func (r *LokiHistorianStore) Get(ctx context.Context, query *annotations.ItemQuery, accessResources *accesscontrol.AccessResources) ([]*annotations.ItemDTO, error) {
if query.Type == "annotation" {
return make([]*annotations.ItemDTO, 0), nil
}
rule := &ngmodels.AlertRule{}
if query.AlertID != 0 {
var err error