grafana/pkg/services/ngalert/state/historian/noop.go
Alexander Weaver 046a9bb7c1
Alerting: Copy rule definitions into state history (#62032)
* Copy rules instead of accepting pointer

* Deep-copy the rule, for even more guarantees

* Create struct just for needed fields

* Move RuleMeta to historian/model package, iron out package dependencies

* Move tests for dash ID parsing to model package along with code
2023-01-25 11:29:57 -06:00

22 lines
605 B
Go

package historian
import (
"context"
"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) RecordStatesAsync(ctx context.Context, _ history_model.RuleMeta, _ []state.StateTransition) <-chan error {
errCh := make(chan error)
close(errCh)
return errCh
}