mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 06:42:21 +08:00
Plugins: Core plugins register via backend factory provider (#43171)
* refactoring store interface and init flow * fix import * fix linter * refactor resource calling * load with class * re-order args * fix tests * fix linter * remove old creator * add custom config struct * fix some tests * cleanup * fix * tackle plugins * fix linter * refactor and fix test * add connect failure error * add fix for azure, cloud monitoring and test data * restructure * remove unused err * add fake tracer for test * fix grafana ds plugin
This commit is contained in:
@ -14,8 +14,6 @@ import (
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin/coreplugin"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tsdb/sqleng"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
@ -23,22 +21,12 @@ import (
|
||||
|
||||
var logger = log.New("tsdb.postgres")
|
||||
|
||||
const pluginID = "postgres"
|
||||
|
||||
func ProvideService(cfg *setting.Cfg, pluginStore plugins.Store) (*Service, error) {
|
||||
func ProvideService(cfg *setting.Cfg) *Service {
|
||||
s := &Service{
|
||||
tlsManager: newTLSManager(logger, cfg.DataPath),
|
||||
}
|
||||
s.im = datasource.NewInstanceManager(s.newInstanceSettings(cfg))
|
||||
factory := coreplugin.New(backend.ServeOpts{
|
||||
QueryDataHandler: s,
|
||||
})
|
||||
|
||||
resolver := plugins.CoreDataSourcePathResolver(cfg, pluginID)
|
||||
if err := pluginStore.AddWithFactory(context.Background(), pluginID, factory, resolver); err != nil {
|
||||
logger.Error("Failed to register plugin", "error", err)
|
||||
}
|
||||
return s, nil
|
||||
return s
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
|
Reference in New Issue
Block a user