c38f6ff182
* tech(routines): move the async logic from notification to alerting notifier
* tech(notification): reduce code dupe
* fix(notification): dont touch the response unless its an error
* feat(alerting): make alerting exeuction async but flow sync
* tech(alerting): remove commented code
* tech(alerting): remove unused code
* tech(alerting): fix typo
* tech(alerting): implement Context on EvalContext
* tech(alerting): wait for all alerts to return
* feat(alerting): dont allow alert responses to cancel
* Revert "feat(alerting): dont allow alert responses to cancel"
This reverts commit 324b006c96.
* feat(alerting): give alerts some time to finish before closing down
27 lines
537 B
Go
27 lines
537 B
Go
package tsdb
|
|
|
|
import "context"
|
|
|
|
type Executor interface {
|
|
Execute(ctx context.Context, queries QuerySlice, context *QueryContext) *BatchResult
|
|
}
|
|
|
|
var registry map[string]GetExecutorFn
|
|
|
|
type GetExecutorFn func(dsInfo *DataSourceInfo) Executor
|
|
|
|
func init() {
|
|
registry = make(map[string]GetExecutorFn)
|
|
}
|
|
|
|
func getExecutorFor(dsInfo *DataSourceInfo) Executor {
|
|
if fn, exists := registry[dsInfo.PluginId]; exists {
|
|
return fn(dsInfo)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func RegisterExecutor(pluginId string, fn GetExecutorFn) {
|
|
registry[pluginId] = fn
|
|
}
|