Revert "K8s: Refactor metrics to share k8s registry (#77957)" (#79079)

This reverts commit 38bc41651a.
This commit is contained in:
Todd Treece
2023-12-05 09:34:07 -05:00
committed by GitHub
parent c30098e772
commit 7e2aad1d01
13 changed files with 39 additions and 197 deletions
+2 -4
View File
@@ -4,14 +4,12 @@ import (
"strconv"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/grafana/grafana/pkg/extensions"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/setting"
)
func setBuildInfo(reg prometheus.Registerer, opts ServerOptions) {
func setBuildInfo(opts ServerOptions) {
buildstampInt64, err := strconv.ParseInt(opts.BuildStamp, 10, 64)
if err != nil || buildstampInt64 == 0 {
buildstampInt64 = time.Now().Unix()
@@ -24,5 +22,5 @@ func setBuildInfo(reg prometheus.Registerer, opts ServerOptions) {
setting.IsEnterprise = extensions.IsEnterprise
setting.Packaging = validPackaging(Packaging)
metrics.SetBuildInformation(reg, opts.Version, opts.Commit, opts.BuildBranch, buildstampInt64)
metrics.SetBuildInformation(opts.Version, opts.Commit, opts.BuildBranch, buildstampInt64)
}
+3 -4
View File
@@ -16,7 +16,6 @@ import (
"github.com/grafana/grafana/pkg/api"
gcli "github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/infra/process"
"github.com/grafana/grafana/pkg/server"
_ "github.com/grafana/grafana/pkg/services/alerting/conditions"
@@ -98,6 +97,9 @@ func RunServer(opts ServerOptions) error {
}
}()
setBuildInfo(opts)
checkPrivileges()
configOptions := strings.Split(ConfigOverrides, " ")
cfg, err := setting.NewCfgFromArgs(setting.CommandLineArgs{
Config: ConfigFile,
@@ -109,9 +111,6 @@ func RunServer(opts ServerOptions) error {
return err
}
setBuildInfo(metrics.ProvideRegisterer(cfg), opts)
checkPrivileges()
s, err := server.Initialize(
cfg,
server.Options{
+3 -4
View File
@@ -11,7 +11,6 @@ import (
"github.com/grafana/grafana/pkg/api"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/server"
"github.com/grafana/grafana/pkg/setting"
)
@@ -75,6 +74,9 @@ func RunTargetServer(opts ServerOptions) error {
}
}()
setBuildInfo(opts)
checkPrivileges()
configOptions := strings.Split(ConfigOverrides, " ")
cfg, err := setting.NewCfgFromArgs(setting.CommandLineArgs{
Config: ConfigFile,
@@ -86,9 +88,6 @@ func RunTargetServer(opts ServerOptions) error {
return err
}
setBuildInfo(metrics.ProvideRegisterer(cfg), opts)
checkPrivileges()
s, err := server.InitializeModuleServer(
cfg,
server.Options{