Plugins: Remove pkg/services/org and pkg/services/pluginsintegration/pluginerrs dependencies (#115820)

* remove deps from pkg/plugins

* fmt

* lint fix
This commit is contained in:
Will Browne
2026-01-05 14:10:44 +00:00
committed by GitHub
parent b4a65ac5ac
commit 99cabcb8be
19 changed files with 60 additions and 56 deletions
@@ -11,7 +11,7 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/initialization"
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/termination"
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/validation"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/plugins/pluginerrs"
)
var _ pluginsLoader.Service = (*Loader)(nil)
@@ -25,9 +25,9 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/signature"
"github.com/grafana/grafana/pkg/plugins/manager/sources"
"github.com/grafana/grafana/pkg/plugins/pluginassets"
"github.com/grafana/grafana/pkg/plugins/pluginerrs"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
)
@@ -1,82 +0,0 @@
package pluginerrs
import (
"context"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/log"
)
var _ plugins.ErrorResolver = (*Store)(nil)
type Store struct {
errs ErrorTracker
}
func ProvideStore(errs ErrorTracker) *Store {
return &Store{
errs: errs,
}
}
func (s *Store) PluginErrors(ctx context.Context) []*plugins.Error {
errs := s.errs.Errors(ctx)
for _, err := range errs {
err.ErrorCode = err.AsErrorCode()
}
return errs
}
func (s *Store) PluginError(ctx context.Context, pluginID string) *plugins.Error {
err := s.errs.Error(ctx, pluginID)
if err == nil {
return nil
}
err.ErrorCode = err.AsErrorCode()
return err
}
type ErrorRegistry struct {
errs map[string]*plugins.Error
log log.Logger
}
type ErrorTracker interface {
Record(ctx context.Context, err *plugins.Error)
Clear(ctx context.Context, pluginID string)
Errors(ctx context.Context) []*plugins.Error
Error(ctx context.Context, pluginID string) *plugins.Error
}
func ProvideErrorTracker() *ErrorRegistry {
return newErrorRegistry()
}
func newErrorRegistry() *ErrorRegistry {
return &ErrorRegistry{
errs: make(map[string]*plugins.Error),
log: log.New("plugins.errors"),
}
}
func (r *ErrorRegistry) Record(_ context.Context, err *plugins.Error) {
r.errs[err.PluginID] = err
}
func (r *ErrorRegistry) Clear(_ context.Context, pluginID string) {
delete(r.errs, pluginID)
}
func (r *ErrorRegistry) Errors(_ context.Context) []*plugins.Error {
errs := make([]*plugins.Error, 0, len(r.errs))
for _, err := range r.errs {
errs = append(errs, err)
}
return errs
}
func (r *ErrorRegistry) Error(_ context.Context, pluginID string) *plugins.Error {
return r.errs[pluginID]
}
@@ -28,6 +28,7 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/signature"
"github.com/grafana/grafana/pkg/plugins/manager/sources"
pluginassets2 "github.com/grafana/grafana/pkg/plugins/pluginassets"
"github.com/grafana/grafana/pkg/plugins/pluginerrs"
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/caching"
@@ -50,7 +51,6 @@ import (
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginconfig"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugininstaller"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
@@ -22,8 +22,8 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/registry"
"github.com/grafana/grafana/pkg/plugins/manager/signature"
"github.com/grafana/grafana/pkg/plugins/manager/sources"
"github.com/grafana/grafana/pkg/plugins/pluginerrs"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/services/rendering"
)
@@ -25,10 +25,10 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/signature"
"github.com/grafana/grafana/pkg/plugins/manager/signature/statickey"
"github.com/grafana/grafana/pkg/plugins/pluginassets"
"github.com/grafana/grafana/pkg/plugins/pluginerrs"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginconfig"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsources"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"