Chore: Advisor stats (#103711)

This commit is contained in:
Andres Martinez Gotor
2025-04-10 10:51:00 +02:00
committed by GitHub
parent 3f3a4c1e8a
commit 89c70fcdcf
7 changed files with 314 additions and 9 deletions
@@ -16,6 +16,12 @@ import (
"github.com/grafana/grafana/pkg/util"
)
const (
CheckID = "datasource"
HealthCheckStepID = "health-check"
UIDValidationStepID = "uid-validation"
)
type check struct {
DatasourceSvc datasources.DataSourceService
PluginStore pluginstore.Store
@@ -52,7 +58,7 @@ func (c *check) Items(ctx context.Context) ([]any, error) {
}
func (c *check) ID() string {
return "datasource"
return CheckID
}
func (c *check) Steps() []checks.Step {
@@ -69,7 +75,7 @@ func (c *check) Steps() []checks.Step {
type uidValidationStep struct{}
func (s *uidValidationStep) ID() string {
return "uid-validation"
return UIDValidationStepID
}
func (s *uidValidationStep) Title() string {
@@ -122,7 +128,7 @@ func (s *healthCheckStep) Resolution() string {
}
func (s *healthCheckStep) ID() string {
return "health-check"
return HealthCheckStepID
}
func (s *healthCheckStep) Run(ctx context.Context, obj *advisor.CheckSpec, i any) (*advisor.CheckReportFailure, error) {
@@ -18,6 +18,12 @@ import (
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
)
const (
CheckID = "plugin"
DeprecationStepID = "deprecation"
UpdateStepID = "update"
)
func New(
pluginStore pluginstore.Store,
pluginRepo repo.Service,
@@ -43,7 +49,7 @@ type check struct {
}
func (c *check) ID() string {
return "plugin"
return CheckID
}
func (c *check) Items(ctx context.Context) ([]any, error) {
@@ -88,7 +94,7 @@ func (s *deprecationStep) Resolution() string {
}
func (s *deprecationStep) ID() string {
return "deprecation"
return DeprecationStepID
}
func (s *deprecationStep) Run(ctx context.Context, _ *advisor.CheckSpec, it any) (*advisor.CheckReportFailure, error) {
@@ -146,7 +152,7 @@ func (s *updateStep) Resolution() string {
}
func (s *updateStep) ID() string {
return "update"
return UpdateStepID
}
func (s *updateStep) Run(ctx context.Context, _ *advisor.CheckSpec, i any) (*advisor.CheckReportFailure, error) {