Alerting: Delete stub for SQL alert state history backend (#65667)

Delete stub for SQL backend
This commit is contained in:
Alexander Weaver 2023-03-31 11:15:56 -05:00 committed by GitHub
parent 211beae736
commit da4832724e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 38 deletions

View File

@ -435,9 +435,6 @@ func configureHistorianBackend(ctx context.Context, cfg setting.UnifiedAlertingS
} }
return backend, nil return backend, nil
} }
if backend == historian.BackendTypeSQL {
return historian.NewSqlBackend(), nil
}
return nil, fmt.Errorf("unrecognized state history backend: %s", backend) return nil, fmt.Errorf("unrecognized state history backend: %s", backend)
} }

View File

@ -95,7 +95,7 @@ func TestConfigureHistorianBackend(t *testing.T) {
Enabled: true, Enabled: true,
Backend: "multiple", Backend: "multiple",
MultiPrimary: "annotations", MultiPrimary: "annotations",
MultiSecondaries: []string{"sql", "invalid-backend"}, MultiSecondaries: []string{"annotations", "invalid-backend"},
} }
_, err := configureHistorianBackend(context.Background(), cfg, nil, nil, nil, met, logger) _, err := configureHistorianBackend(context.Background(), cfg, nil, nil, nil, met, logger)

View File

@ -18,7 +18,6 @@ const (
BackendTypeLoki BackendType = "loki" BackendTypeLoki BackendType = "loki"
BackendTypeMultiple BackendType = "multiple" BackendTypeMultiple BackendType = "multiple"
BackendTypeNoop BackendType = "noop" BackendTypeNoop BackendType = "noop"
BackendTypeSQL BackendType = "sql"
) )
func ParseBackendType(s string) (BackendType, error) { func ParseBackendType(s string) (BackendType, error) {
@ -29,7 +28,6 @@ func ParseBackendType(s string) (BackendType, error) {
BackendTypeLoki: {}, BackendTypeLoki: {},
BackendTypeMultiple: {}, BackendTypeMultiple: {},
BackendTypeNoop: {}, BackendTypeNoop: {},
BackendTypeSQL: {},
} }
p := BackendType(norm) p := BackendType(norm)
if _, ok := types[p]; !ok { if _, ok := types[p]; !ok {

View File

@ -1,32 +0,0 @@
package historian
import (
"context"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/infra/log"
"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"
)
type SqlBackend struct {
log log.Logger
}
func NewSqlBackend() *SqlBackend {
return &SqlBackend{
log: log.New("ngalert.state.historian"),
}
}
func (h *SqlBackend) Record(ctx context.Context, _ history_model.RuleMeta, _ []state.StateTransition) <-chan error {
errCh := make(chan error)
close(errCh)
return errCh
}
func (h *SqlBackend) Query(ctx context.Context, query models.HistoryQuery) (*data.Frame, error) {
return data.NewFrame("states"), nil
}