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:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user