add core plugins thru store (#43085)

This commit is contained in:
Will Browne
2021-12-14 15:22:40 +01:00
committed by GitHub
parent 5d18834deb
commit e4ba5f17dd
23 changed files with 139 additions and 95 deletions
+5 -2
View File
@@ -52,10 +52,12 @@ const defaultRegion = "default"
const logIdentifierInternal = "__log__grafana_internal__"
const logStreamIdentifierInternal = "__logstream__grafana_internal__"
const pluginID = "cloudwatch"
var plog = log.New("tsdb.cloudwatch")
var aliasFormat = regexp.MustCompile(`\{\{\s*(.+?)\s*\}\}`)
func ProvideService(cfg *setting.Cfg, logsService *LogsService, registrar plugins.CoreBackendRegistrar) (*CloudWatchService, error) {
func ProvideService(cfg *setting.Cfg, logsService *LogsService, pluginStore plugins.Store) (*CloudWatchService, error) {
plog.Debug("initing")
executor := newExecutor(logsService, datasource.NewInstanceManager(NewInstanceSettings()), cfg, awsds.NewSessionCache())
@@ -63,7 +65,8 @@ func ProvideService(cfg *setting.Cfg, logsService *LogsService, registrar plugin
QueryDataHandler: executor,
})
if err := registrar.LoadAndRegister("cloudwatch", factory); err != nil {
resolver := plugins.CoreDataSourcePathResolver(cfg, pluginID)
if err := pluginStore.AddWithFactory(context.Background(), pluginID, factory, resolver); err != nil {
plog.Error("Failed to register plugin", "error", err)
return nil, err
}