Alerting: Create new state history "fanout" backend that dispatches to multiple other backends at once (#64774)

* Rename RecordStatesAsync to Record

* Rename QueryStates to Query

* Implement fanout writes

* Implement primary queries

* Simplify error joining

* Add test for query path

* Add tests for writes and error propagation

* Allow fanout backend to be configured

* Touch up log messages and config validation

* Consistent documentation for all backend structs

* Parse and normalize backend names more consistently against an enum

* Touch-ups to documentation

* Improve clarity around multi-record blocking

* Keep primary and secondaries more distinct

* Rename fanout backend to multiple backend

* Simplify config keys for multi backend mode
This commit is contained in:
Alexander Weaver
2023-03-17 12:41:18 -05:00
committed by GitHub
parent e01a3e0ea5
commit a31672fa40
18 changed files with 281 additions and 28 deletions
@@ -14,7 +14,7 @@ import (
)
type Historian interface {
QueryStates(ctx context.Context, query models.HistoryQuery) (*data.Frame, error)
Query(ctx context.Context, query models.HistoryQuery) (*data.Frame, error)
}
type HistorySrv struct {
@@ -44,7 +44,7 @@ func (srv *HistorySrv) RouteQueryStateHistory(c *contextmodel.ReqContext) respon
To: time.Unix(to, 0),
Labels: labels,
}
frame, err := srv.hist.QueryStates(c.Req.Context(), query)
frame, err := srv.hist.Query(c.Req.Context(), query)
if err != nil {
return ErrResp(http.StatusInternalServerError, err, "")
}