mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* 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
28 lines
842 B
Go
28 lines
842 B
Go
package historian
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/data"
|
|
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
|
"github.com/grafana/grafana/pkg/services/ngalert/state"
|
|
history_model "github.com/grafana/grafana/pkg/services/ngalert/state/historian/model"
|
|
)
|
|
|
|
// NoOpHistorian is a state.Historian that does nothing with the resulting data, to be used in contexts where history is not needed.
|
|
type NoOpHistorian struct{}
|
|
|
|
func NewNopHistorian() *NoOpHistorian {
|
|
return &NoOpHistorian{}
|
|
}
|
|
|
|
func (f *NoOpHistorian) Record(ctx context.Context, _ history_model.RuleMeta, _ []state.StateTransition) <-chan error {
|
|
errCh := make(chan error)
|
|
close(errCh)
|
|
return errCh
|
|
}
|
|
|
|
func (f *NoOpHistorian) Query(ctx context.Context, query models.HistoryQuery) (*data.Frame, error) {
|
|
return data.NewFrame("states"), nil
|
|
}
|