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.
|
// corePlugin represents a plugin that's part of Grafana core.
|
||||||
type corePlugin struct {
|
type corePlugin struct {
|
||||||
isDataPlugin bool
|
pluginID string
|
||||||
pluginID string
|
logger log.Logger
|
||||||
logger log.Logger
|
|
||||||
backend.CheckHealthHandler
|
backend.CheckHealthHandler
|
||||||
backend.CallResourceHandler
|
backend.CallResourceHandler
|
||||||
backend.QueryDataHandler
|
backend.QueryDataHandler
|
||||||
@ -44,10 +43,6 @@ func (cp *corePlugin) Logger() log.Logger {
|
|||||||
return cp.logger
|
return cp.logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cp *corePlugin) CanHandleDataQueries() bool {
|
|
||||||
return cp.isDataPlugin
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cp *corePlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
|
func (cp *corePlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
|
||||||
tsdbQuery plugins.DataQuery) (plugins.DataResponse, error) {
|
tsdbQuery plugins.DataQuery) (plugins.DataResponse, error) {
|
||||||
// TODO: Inline the adapter, since it shouldn't be necessary
|
// 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 {
|
func (cp *corePlugin) Start(ctx context.Context) error {
|
||||||
cp.isDataPlugin = cp.QueryDataHandler != nil
|
|
||||||
return 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 {
|
func (p *grpcPlugin) PluginID() string {
|
||||||
return p.descriptor.pluginID
|
return p.descriptor.pluginID
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ type Plugin interface {
|
|||||||
Stop(ctx context.Context) error
|
Stop(ctx context.Context) error
|
||||||
IsManaged() bool
|
IsManaged() bool
|
||||||
Exited() bool
|
Exited() bool
|
||||||
CanHandleDataQueries() bool
|
|
||||||
backend.CollectMetricsHandler
|
backend.CollectMetricsHandler
|
||||||
backend.CheckHealthHandler
|
backend.CheckHealthHandler
|
||||||
backend.CallResourceHandler
|
backend.CallResourceHandler
|
||||||
|
@ -115,7 +115,7 @@ func (m *manager) getAWSEnvironmentVariables() []string {
|
|||||||
|
|
||||||
func (m *manager) GetDataPlugin(pluginID string) interface{} {
|
func (m *manager) GetDataPlugin(pluginID string) interface{} {
|
||||||
plugin := m.plugins[pluginID]
|
plugin := m.plugins[pluginID]
|
||||||
if plugin == nil || !plugin.CanHandleDataQueries() {
|
if plugin == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,10 +337,6 @@ func (tp *testPlugin) Logger() log.Logger {
|
|||||||
return tp.logger
|
return tp.logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tp *testPlugin) CanHandleDataQueries() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tp *testPlugin) Start(ctx context.Context) error {
|
func (tp *testPlugin) Start(ctx context.Context) error {
|
||||||
tp.mutex.Lock()
|
tp.mutex.Lock()
|
||||||
defer tp.mutex.Unlock()
|
defer tp.mutex.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user