grafana/pkg/plugins/backendplugin/plugin.go
Marcus Efraimsson c0f3b2929c
Backend plugins: Refactor to allow shared contract between core and external backend plugins (#25472)
Refactor to allow shared contract between core and external backend plugins 
allowing core backend data sources in Grafana to be implemented in same 
way as an external backend plugin.
Use v0.67.0 of sdk.
Add tests for verifying plugin is restarted when process is killed.
Enable strict linting for backendplugin packages
2020-06-11 16:14:05 +02:00

31 lines
778 B
Go

package backendplugin
import (
"context"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/infra/log"
)
// Plugin backend plugin interface.
type Plugin interface {
PluginID() string
Logger() log.Logger
Start(ctx context.Context) error
Stop(ctx context.Context) error
IsManaged() bool
Exited() bool
backend.CollectMetricsHandler
backend.CheckHealthHandler
backend.CallResourceHandler
}
// PluginFactoryFunc factory for creating a Plugin.
type PluginFactoryFunc func(pluginID string, logger log.Logger, env []string) (Plugin, error)
// CallResourceClientResponseStream is used for receiving resource call responses.
type CallResourceClientResponseStream interface {
Recv() (*backend.CallResourceResponse, error)
Close() error
}