mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
c0f3b2929c
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
31 lines
778 B
Go
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
|
|
}
|