Documentation
¶
Index ¶
- Constants
- Variables
- type BackendFactoryProvider
- type BuildInfo
- type Cfg
- type Class
- type Client
- type DashboardFileStore
- type DataSourceDTO
- type Dependencies
- type Dependency
- type DuplicateError
- type Error
- type ErrorCode
- type ErrorResolver
- type GetPluginDashboardFileContentsArgs
- type GetPluginDashboardFileContentsResult
- type Header
- type Includes
- type Info
- type InfoLink
- type Installer
- type JSONData
- type JWTTokenAuth
- type ListPluginDashboardFilesArgs
- type ListPluginDashboardFilesResult
- type Loader
- type Logos
- type NotFoundError
- type PanelDTO
- type Plugin
- func (p *Plugin) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (p *Plugin) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (p *Plugin) Client() (PluginClient, bool)
- func (p *Plugin) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
- func (p *Plugin) Decommission() error
- func (p *Plugin) Exited() bool
- func (p *Plugin) IsApp() bool
- func (p *Plugin) IsBundledPlugin() bool
- func (p *Plugin) IsCorePlugin() bool
- func (p *Plugin) IsDataSource() bool
- func (p *Plugin) IsDecommissioned() bool
- func (p *Plugin) IsExternalPlugin() bool
- func (p *Plugin) IsManaged() bool
- func (p *Plugin) IsPanel() bool
- func (p *Plugin) IsRenderer() bool
- func (p *Plugin) Logger() log.Logger
- func (p *Plugin) PluginID() string
- func (p *Plugin) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
- func (p *Plugin) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (p *Plugin) RegisterClient(c backendplugin.Plugin)
- func (p *Plugin) RunStream(ctx context.Context, req *backend.RunStreamRequest, ...) error
- func (p *Plugin) SetLogger(l log.Logger)
- func (p *Plugin) Start(ctx context.Context) error
- func (p *Plugin) StaticRoute() *StaticRoute
- func (p *Plugin) Stop(ctx context.Context) error
- func (p *Plugin) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
- func (p *Plugin) ToDTO() PluginDTO
- type PluginClient
- type PluginDTO
- type PluginFiles
- type PluginLoaderAuthorizer
- type PluginMetaDTO
- type PreloadPlugin
- type ReleaseState
- type RendererManager
- type Route
- type Screenshots
- type Signature
- type SignatureError
- type SignatureStatus
- type SignatureType
- type StaticRoute
- type StaticRouteResolver
- type Store
- type Type
- type URLParam
- type UpdateInfo
Constants ¶
const (
TypeDashboard = "dashboard"
)
Variables ¶
var ( ErrInstallCorePlugin = errors.New("cannot install a Core plugin") ErrUninstallCorePlugin = errors.New("cannot uninstall a Core plugin") ErrUninstallOutsideOfPluginDir = errors.New("cannot uninstall a plugin outside") ErrPluginNotInstalled = errors.New("plugin is not installed") )
var PluginTypes = []Type{ DataSource, Panel, App, Renderer, }
Functions ¶
This section is empty.
Types ¶
type BackendFactoryProvider ¶
type BackendFactoryProvider interface {
BackendFactory(ctx context.Context, p *Plugin) backendplugin.PluginFactoryFunc
}
BackendFactoryProvider provides a backend factory for a provided plugin.
type Cfg ¶
type Cfg struct { DevMode bool PluginsPath string PluginSettings setting.PluginSettings PluginsAllowUnsigned []string EnterpriseLicensePath string // AWS Plugin Auth AWSAllowedAuthProviders []string AWSAssumeRoleEnabled bool // Azure Cloud settings Azure *azsettings.AzureSettings BuildVersion string // TODO Remove }
func FromGrafanaCfg ¶
type Client ¶
type Client interface { backend.QueryDataHandler backend.CheckHealthHandler backend.StreamHandler backend.CallResourceHandler backend.CollectMetricsHandler }
Client is used to communicate with backend plugin implementations.
type DashboardFileStore ¶
type DashboardFileStore interface { // ListPluginDashboardFiles lists plugin dashboard files. ListPluginDashboardFiles(ctx context.Context, args *ListPluginDashboardFilesArgs) (*ListPluginDashboardFilesResult, error) // GetPluginDashboardFileContents gets the referenced plugin dashboard file content. GetPluginDashboardFileContents(ctx context.Context, args *GetPluginDashboardFileContentsArgs) (*GetPluginDashboardFileContentsResult, error) }
DashboardFileStore is the interface for plugin dashboard file storage.
type DataSourceDTO ¶
type DataSourceDTO struct { ID int64 `json:"id,omitempty"` UID string `json:"uid,omitempty"` Type string `json:"type"` Name string `json:"name"` PluginMeta *PluginMetaDTO `json:"meta"` URL string `json:"url,omitempty"` IsDefault bool `json:"isDefault"` Access string `json:"access,omitempty"` Preload bool `json:"preload"` Module string `json:"module,omitempty"` JSONData map[string]interface{} `json:"jsonData"` BasicAuth string `json:"basicAuth,omitempty"` WithCredentials bool `json:"withCredentials,omitempty"` // InfluxDB Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` // InfluxDB + Elasticsearch Database string `json:"database,omitempty"` // Prometheus DirectURL string `json:"directUrl,omitempty"` }
type Dependencies ¶
type Dependencies struct { GrafanaDependency string `json:"grafanaDependency"` GrafanaVersion string `json:"grafanaVersion"` Plugins []Dependency `json:"plugins"` }
type Dependency ¶
type DuplicateError ¶
func (DuplicateError) Error ¶
func (e DuplicateError) Error() string
func (DuplicateError) Is ¶
func (e DuplicateError) Is(err error) bool
type ErrorResolver ¶
type ErrorResolver interface {
PluginErrors() []*Error
}
type GetPluginDashboardFileContentsArgs ¶
GetPluginDashboardFileContentsArgs get plugin dashboard file content argument model.
type GetPluginDashboardFileContentsResult ¶
type GetPluginDashboardFileContentsResult struct {
Content io.ReadCloser
}
GetPluginDashboardFileContentsResult get plugin dashboard file content result model.
type Header ¶
Header describes an HTTP header that is forwarded with the proxied request for a plugin route
type Includes ¶
type Includes struct { Name string `json:"name"` Path string `json:"path"` Type string `json:"type"` Component string `json:"component"` Role models.RoleType `json:"role"` Slug string `json:"slug"` Icon string `json:"icon"` UID string `json:"uid"` ID string `json:"-"` }
func (Includes) DashboardURLPath ¶
type Installer ¶
type Installer interface { // Install downloads the requested plugin in the provided file system location. Install(ctx context.Context, pluginID, version, pluginsDir, pluginZipURL, pluginRepoURL string) error // Uninstall removes the requested plugin from the provided file system location. Uninstall(ctx context.Context, pluginDir string) error // GetUpdateInfo provides update information for the requested plugin. GetUpdateInfo(ctx context.Context, pluginID, version, pluginRepoURL string) (UpdateInfo, error) }
Installer is responsible for managing plugins (add / remove) on the file system.
type JSONData ¶
type JSONData struct { // Common settings ID string `json:"id"` Type Type `json:"type"` Name string `json:"name"` Info Info `json:"info"` Dependencies Dependencies `json:"dependencies"` Includes []*Includes `json:"includes"` State ReleaseState `json:"state,omitempty"` Category string `json:"category"` HideFromList bool `json:"hideFromList,omitempty"` Preload bool `json:"preload"` Backend bool `json:"backend"` Routes []*Route `json:"routes"` // Panel settings SkipDataQuery bool `json:"skipDataQuery"` // App settings AutoEnabled bool `json:"autoEnabled"` // Datasource settings Annotations bool `json:"annotations"` Metrics bool `json:"metrics"` Alerting bool `json:"alerting"` Explore bool `json:"explore"` Table bool `json:"tables"` Logs bool `json:"logs"` Tracing bool `json:"tracing"` QueryOptions map[string]bool `json:"queryOptions,omitempty"` BuiltIn bool `json:"builtIn,omitempty"` Mixed bool `json:"mixed,omitempty"` Streaming bool `json:"streaming"` SDK bool `json:"sdk,omitempty"` // Backend (Datasource + Renderer) Executable string `json:"executable,omitempty"` }
JSONData represents the plugin's plugin.json
func (JSONData) DashboardIncludes ¶
type JWTTokenAuth ¶
type JWTTokenAuth struct { Url string `json:"url"` Scopes []string `json:"scopes"` Params map[string]string `json:"params"` }
JWTTokenAuth struct is both for normal Token Auth and JWT Token Auth with an uploaded JWT file.
type ListPluginDashboardFilesArgs ¶
type ListPluginDashboardFilesArgs struct {
PluginID string
}
ListPluginDashboardFilesArgs list plugin dashboard files argument model.
type ListPluginDashboardFilesResult ¶
type ListPluginDashboardFilesResult struct {
FileReferences []string
}
GetPluginDashboardFilesArgs list plugin dashboard files result model.
type Loader ¶
type Loader interface { // Load will return a list of plugins found in the provided file system paths. Load(ctx context.Context, class Class, paths []string, ignore map[string]struct{}) ([]*Plugin, error) }
Loader is responsible for loading plugins from the file system.
type NotFoundError ¶
type NotFoundError struct {
PluginID string
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type PanelDTO ¶
type PanelDTO struct { ID string `json:"id"` Name string `json:"name"` Info Info `json:"info"` HideFromList bool `json:"hideFromList"` Sort int `json:"sort"` SkipDataQuery bool `json:"skipDataQuery"` ReleaseState string `json:"state"` BaseURL string `json:"baseUrl"` Signature string `json:"signature"` Module string `json:"module"` }
type Plugin ¶
type Plugin struct { JSONData PluginDir string Class Class // App fields IncludedInAppID string Pinned bool // Signature fields Signature SignatureStatus SignatureType SignatureType SignatureOrg string Parent *Plugin Children []*Plugin SignedFiles PluginFiles SignatureError *SignatureError // SystemJS fields Module string BaseURL string Renderer pluginextensionv2.RendererPlugin // contains filtered or unexported fields }
func (*Plugin) CallResource ¶
func (p *Plugin) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
func (*Plugin) CheckHealth ¶
func (p *Plugin) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
func (*Plugin) Client ¶
func (p *Plugin) Client() (PluginClient, bool)
func (*Plugin) CollectMetrics ¶
func (p *Plugin) CollectMetrics(ctx context.Context, req *backend.CollectMetricsRequest) (*backend.CollectMetricsResult, error)
func (*Plugin) Decommission ¶
func (*Plugin) IsBundledPlugin ¶
func (*Plugin) IsCorePlugin ¶
func (*Plugin) IsDataSource ¶
func (*Plugin) IsDecommissioned ¶
func (*Plugin) IsExternalPlugin ¶
func (*Plugin) IsRenderer ¶
func (*Plugin) PublishStream ¶
func (p *Plugin) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
func (*Plugin) QueryData ¶
func (p *Plugin) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
func (*Plugin) RegisterClient ¶
func (p *Plugin) RegisterClient(c backendplugin.Plugin)
func (*Plugin) RunStream ¶
func (p *Plugin) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
func (*Plugin) StaticRoute ¶
func (p *Plugin) StaticRoute() *StaticRoute
func (*Plugin) SubscribeStream ¶
func (p *Plugin) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
type PluginClient ¶
type PluginClient interface { backend.QueryDataHandler backend.CollectMetricsHandler backend.CheckHealthHandler backend.CallResourceHandler backend.StreamHandler }
type PluginDTO ¶
type PluginDTO struct { JSONData PluginDir string Class Class // App fields IncludedInAppID string Pinned bool // Signature fields Signature SignatureStatus SignatureType SignatureType SignatureOrg string SignedFiles PluginFiles SignatureError *SignatureError // SystemJS fields Module string BaseURL string // temporary backend.StreamHandler }
func (PluginDTO) IncludedInSignature ¶
func (PluginDTO) IsCorePlugin ¶
func (PluginDTO) SupportsStreaming ¶
type PluginFiles ¶
type PluginFiles map[string]struct{}
type PluginLoaderAuthorizer ¶
type PluginMetaDTO ¶
type PluginMetaDTO struct { JSONData Signature SignatureStatus `json:"signature"` Module string `json:"module"` BaseURL string `json:"baseUrl"` }
type PreloadPlugin ¶
type RendererManager ¶
type RendererManager interface { // Renderer returns a renderer plugin. Renderer() *Plugin }
type Route ¶
type Route struct { Path string `json:"path"` Method string `json:"method"` ReqRole models.RoleType `json:"reqRole"` URL string `json:"url"` URLParams []URLParam `json:"urlParams"` Headers []Header `json:"headers"` AuthType string `json:"authType"` TokenAuth *JWTTokenAuth `json:"tokenAuth"` JwtTokenAuth *JWTTokenAuth `json:"jwtTokenAuth"` Body json.RawMessage `json:"body"` }
Route describes a plugin route that is defined in the plugin.json file for a plugin.
type Screenshots ¶
type Signature ¶
type Signature struct { Status SignatureStatus Type SignatureType SigningOrg string Files PluginFiles }
type SignatureError ¶
type SignatureError struct { PluginID string `json:"pluginId"` SignatureStatus SignatureStatus `json:"status"` }
func (SignatureError) AsErrorCode ¶
func (e SignatureError) AsErrorCode() ErrorCode
func (SignatureError) Error ¶
func (e SignatureError) Error() string
type SignatureStatus ¶
type SignatureStatus string
const ( SignatureInternal SignatureStatus = "internal" // core plugin, no signature SignatureValid SignatureStatus = "valid" // signed and accurate MANIFEST SignatureInvalid SignatureStatus = "invalid" // invalid signature SignatureModified SignatureStatus = "modified" // valid signature, but content mismatch SignatureUnsigned SignatureStatus = "unsigned" // no MANIFEST file )
func (SignatureStatus) IsInternal ¶
func (ss SignatureStatus) IsInternal() bool
func (SignatureStatus) IsValid ¶
func (ss SignatureStatus) IsValid() bool
type SignatureType ¶
type SignatureType string
const ( GrafanaSignature SignatureType = "grafana" CommercialSignature SignatureType = "commercial" CommunitySignature SignatureType = "community" PrivateSignature SignatureType = "private" )
func (SignatureType) IsValid ¶
func (s SignatureType) IsValid() bool
type StaticRoute ¶
type StaticRouteResolver ¶
type StaticRouteResolver interface {
Routes() []*StaticRoute
}
type Store ¶
type Store interface { // Plugin finds a plugin by its ID. Plugin(ctx context.Context, pluginID string) (PluginDTO, bool) // Plugins returns plugins by their requested type. Plugins(ctx context.Context, pluginTypes ...Type) []PluginDTO // Add adds a plugin to the store. Add(ctx context.Context, pluginID, version string) error // Remove removes a plugin from the store. Remove(ctx context.Context, pluginID string) error }
Store is the storage for plugins.
type UpdateInfo ¶
type UpdateInfo struct {
PluginZipURL string
}
Directories
¶
Path | Synopsis |
---|---|
Package adapters contains plugin SDK adapters.
|
Package adapters contains plugin SDK adapters. |
Package backendplugin contains backend plugin related logic.
|
Package backendplugin contains backend plugin related logic. |
instrumentation
Package instrumentation contains backend plugin instrumentation logic.
|
Package instrumentation contains backend plugin instrumentation logic. |
codegen
module
|
|
sdk
module
|