mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove unnecessary state (#32278)
This commit is contained in:
parent
f37c8c10c5
commit
1d7f155c92
@ -13,9 +13,8 @@ import (
|
||||
|
||||
// corePlugin represents a plugin that's part of Grafana core.
|
||||
type corePlugin struct {
|
||||
isDataPlugin bool
|
||||
pluginID string
|
||||
logger log.Logger
|
||||
pluginID string
|
||||
logger log.Logger
|
||||
backend.CheckHealthHandler
|
||||
backend.CallResourceHandler
|
||||
backend.QueryDataHandler
|
||||
@ -44,10 +43,6 @@ func (cp *corePlugin) Logger() log.Logger {
|
||||
return cp.logger
|
||||
}
|
||||
|
||||
func (cp *corePlugin) CanHandleDataQueries() bool {
|
||||
return cp.isDataPlugin
|
||||
}
|
||||
|
||||
func (cp *corePlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
|
||||
tsdbQuery plugins.DataQuery) (plugins.DataResponse, error) {
|
||||
// TODO: Inline the adapter, since it shouldn't be necessary
|
||||
@ -57,7 +52,6 @@ func (cp *corePlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
|
||||
}
|
||||
|
||||
func (cp *corePlugin) Start(ctx context.Context) error {
|
||||
cp.isDataPlugin = cp.QueryDataHandler != nil
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,6 @@ func newPlugin(descriptor PluginDescriptor) backendplugin.PluginFactoryFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *grpcPlugin) CanHandleDataQueries() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *grpcPlugin) PluginID() string {
|
||||
return p.descriptor.pluginID
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ type Plugin interface {
|
||||
Stop(ctx context.Context) error
|
||||
IsManaged() bool
|
||||
Exited() bool
|
||||
CanHandleDataQueries() bool
|
||||
backend.CollectMetricsHandler
|
||||
backend.CheckHealthHandler
|
||||
backend.CallResourceHandler
|
||||
|
@ -115,7 +115,7 @@ func (m *manager) getAWSEnvironmentVariables() []string {
|
||||
|
||||
func (m *manager) GetDataPlugin(pluginID string) interface{} {
|
||||
plugin := m.plugins[pluginID]
|
||||
if plugin == nil || !plugin.CanHandleDataQueries() {
|
||||
if plugin == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -337,10 +337,6 @@ func (tp *testPlugin) Logger() log.Logger {
|
||||
return tp.logger
|
||||
}
|
||||
|
||||
func (tp *testPlugin) CanHandleDataQueries() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (tp *testPlugin) Start(ctx context.Context) error {
|
||||
tp.mutex.Lock()
|
||||
defer tp.mutex.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user