Alerting: Log expression command types during evaluation (#84614)

This commit is contained in:
Yuri Tseretyan
2024-03-19 10:00:03 -04:00
committed by GitHub
parent 09817e2c7f
commit 9dc4221508
11 changed files with 101 additions and 0 deletions
+2
View File
@@ -31,6 +31,8 @@ type Command interface {
// Execute creates a payload send request to the ML API by calling the function argument sendRequest, and then parses response.
// Function sendRequest is supposed to abstract the client configuration such creating http request, adding authorization parameters, host etc.
Execute(from, to time.Time, sendRequest func(method string, path string, payload []byte) (response.Response, error)) (*backend.QueryDataResponse, error)
Type() string
}
// UnmarshalCommand parses a config parameters and creates a command. Requires key `type` to be specified.
+4
View File
@@ -19,6 +19,10 @@ type OutlierCommand struct {
var _ Command = OutlierCommand{}
func (c OutlierCommand) Type() string {
return "outlier"
}
func (c OutlierCommand) DatasourceUID() string {
return c.config.DatasourceUID
}
+4
View File
@@ -42,3 +42,7 @@ func (f *FakeCommand) Execute(from, to time.Time, executor func(method string, p
}
return f.Response, f.Error
}
func (f *FakeCommand) Type() string {
return "fake"
}