grafana/pkg/services/ngalert/writer/fake.go
William Wernert 5de7d4d06d
Alerting: Create writer interface for recording rules (#88459)
* Create writer interface for recording rules

Also create fake impl + use it for stub in scheduler
2024-05-29 22:38:33 +03:00

21 lines
476 B
Go

package writer
import (
"context"
"time"
"github.com/grafana/grafana-plugin-sdk-go/data"
)
type FakeWriter struct {
WriteFunc func(ctx context.Context, name string, t time.Time, frames data.Frames, extraLabels map[string]string) error
}
func (w FakeWriter) Write(ctx context.Context, name string, t time.Time, frames data.Frames, extraLabels map[string]string) error {
if w.WriteFunc == nil {
return nil
}
return w.WriteFunc(ctx, name, t, frames, extraLabels)
}