mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
f5076d1868
* Plugins: Chore: Renamed instrumentation middleware to metrics middleware * Removed repeated logger attributes in middleware and contextual logger * renamed loggerParams to logParams * PR review suggestion * Add pluginsInstrumentationStatusSource feature toggle * Plugin error source prometheus metrics * Add error_source to logs * re-generate feature toggles * fix compilation issues * remove unwanted changes * Removed logger middleware changes, implement error source using context * Renamed pluginmeta to pluginrequestmeta, changed some method names * Fix comment * pluginrequestmeta.go -> plugin_request_meta.go * Replaced plugin request meta with status source * Add tests for pluginrequestmeta status source * Fix potential nil pointer dereference in instrmentation middleware * Add metrics middleware tests * Sort imports in clienttest.go * Add StatusSourceFromContext test * Add error_source label to plugin_request_duration_seconds * Re-generate feature flags * lint * Use StatusSourcePlugin by default * re-generate feature flags
39 lines
1.8 KiB
Go
39 lines
1.8 KiB
Go
package plugins
|
|
|
|
import "github.com/grafana/grafana/pkg/util/errutil"
|
|
|
|
var (
|
|
errPluginNotRegisteredBase = errutil.NotFound("plugin.notRegistered",
|
|
errutil.WithPublicMessage("Plugin not registered"))
|
|
// ErrPluginNotRegistered error returned when a plugin is not registered.
|
|
ErrPluginNotRegistered = errPluginNotRegisteredBase.Errorf("plugin not registered")
|
|
|
|
errPluginUnavailableBase = errutil.Internal("plugin.unavailable",
|
|
errutil.WithPublicMessage("Plugin unavailable"))
|
|
// ErrPluginUnavailable error returned when a plugin is unavailable.
|
|
ErrPluginUnavailable = errPluginUnavailableBase.Errorf("plugin unavailable")
|
|
|
|
errMethodNotImplementedBase = errutil.NotFound("plugin.notImplemented",
|
|
errutil.WithPublicMessage("Method not implemented"))
|
|
// ErrMethodNotImplemented error returned when a plugin method is not implemented.
|
|
ErrMethodNotImplemented = errMethodNotImplementedBase.Errorf("method not implemented")
|
|
|
|
// ErrPluginHealthCheck error returned when a plugin fails its health check.
|
|
// Exposed as a base error to wrap it with plugin error.
|
|
ErrPluginHealthCheck = errutil.Internal("plugin.healthCheck",
|
|
errutil.WithPublicMessage("Plugin health check failed"),
|
|
errutil.WithDownstream())
|
|
|
|
// ErrPluginDownstreamErrorBase error returned when a plugin request fails.
|
|
// Exposed as a base error to wrap it with plugin downstream errors.
|
|
ErrPluginDownstreamErrorBase = errutil.Internal("plugin.downstreamError",
|
|
errutil.WithPublicMessage("An error occurred within the plugin"),
|
|
errutil.WithDownstream())
|
|
|
|
// ErrPluginRequestCanceledErrorBase error returned when a plugin request
|
|
// is cancelled by the client (context is cancelled).
|
|
// Exposed as a base error to wrap it with plugin cancelled errors.
|
|
ErrPluginRequestCanceledErrorBase = errutil.ClientClosedRequest("plugin.requestCanceled",
|
|
errutil.WithPublicMessage("Plugin request canceled"))
|
|
)
|