Add more metrics to the IAM Folder Reconciler (#111275)

* Add more metrics to the operator

* Add namespace when logging metrics

* Skip flaky test
This commit is contained in:
Mihai Turdean
2025-09-18 09:03:32 -06:00
committed by GitHub
parent 28952cc490
commit aaa8094a53
13 changed files with 471 additions and 339 deletions
+12 -6
View File
@@ -217,12 +217,18 @@ func (s *ModuleServer) initOperatorServer() (services.Service, error) {
return services.NewBasicService(
nil,
func(ctx context.Context) error {
context := cli.NewContext(&cli.App{}, nil, nil)
return op.RunFunc(standalone.BuildInfo{
Version: s.version,
Commit: s.commit,
BuildBranch: s.buildBranch,
}, context, s.cfg)
cliContext := cli.NewContext(&cli.App{}, nil, nil)
deps := OperatorDependencies{
BuildInfo: standalone.BuildInfo{
Version: s.version,
Commit: s.commit,
BuildBranch: s.buildBranch,
},
CLIContext: cliContext,
Config: s.cfg,
Registerer: s.registerer,
}
return op.RunFunc(deps)
},
nil,
).WithName("operator"), nil
+11 -1
View File
@@ -1,16 +1,26 @@
package server
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/grafana/grafana/pkg/services/apiserver/standalone"
"github.com/grafana/grafana/pkg/setting"
"github.com/urfave/cli/v2"
)
// OperatorDependencies contains all the dependencies that operators need
type OperatorDependencies struct {
BuildInfo standalone.BuildInfo
CLIContext *cli.Context
Config *setting.Cfg
Registerer prometheus.Registerer
}
// Operator represents an app operator that is available in the Grafana binary
type Operator struct {
Name string
Description string
RunFunc func(standalone.BuildInfo, *cli.Context, *setting.Cfg) error
RunFunc func(deps OperatorDependencies) error
}
var operatorsRegistry []Operator