mirror of
https://github.com/grafana/grafana.git
synced 2025-09-24 19:03:49 +08:00

* 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 324b006c96687da18a542942f39c10c99119430c. * 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
|
|
}
|