From 1dc8c5aeff594b7fb9db4e0362a605ed5c8c1e41 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Thu, 11 Jan 2024 13:38:48 -0500 Subject: [PATCH] Alternative method for triggering support --- pkg/metrics/agent.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/metrics/agent.go b/pkg/metrics/agent.go index 6f975dcd0672..5528ddc3723c 100644 --- a/pkg/metrics/agent.go +++ b/pkg/metrics/agent.go @@ -13,6 +13,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/model" "go.uber.org/atomic" "google.golang.org/grpc" @@ -20,7 +21,6 @@ import ( "github.com/grafana/agent/pkg/metrics/cluster/client" "github.com/grafana/agent/pkg/metrics/instance" "github.com/grafana/agent/pkg/util" - "github.com/prometheus/common/model" "github.com/prometheus/prometheus/discovery" ) @@ -35,7 +35,7 @@ var DefaultConfig = Config{ ServiceClientConfig: client.DefaultConfig, InstanceMode: instance.DefaultMode, UTF8Names: false, - NameEscapingScheme: model.DefaultNameEscapingScheme.String(), + // NameEscapingScheme: model.NameEscapingScheme.String(), } // Config defines the configuration for the entire set of Prometheus client @@ -125,7 +125,7 @@ func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { f.DurationVar(&c.WALCleanupPeriod, prefix+"wal-cleanup-period", DefaultConfig.WALCleanupPeriod, "how often to check for abandoned WALs") f.DurationVar(&c.InstanceRestartBackoff, prefix+"instance-restart-backoff", DefaultConfig.InstanceRestartBackoff, "how long to wait before restarting a failed Prometheus instance") f.BoolVar(&c.UTF8Names, prefix+"utf8-names", DefaultConfig.UTF8Names, "yup this again") - f.StringVar(&c.NameEscapingScheme, prefix+"name-escaping-scheme", model.DefaultNameEscapingScheme.String(), "method to escape legacy invalid names when sending to an old version of prometheus. can be one of values (default), underscores, or dots") + f.StringVar(&c.NameEscapingScheme, prefix+"name-escaping-scheme", model.NameEscapingScheme.String(), "method to escape legacy invalid names when sending to an old version of prometheus. can be one of values (default), underscores, or dots") c.ServiceConfig.RegisterFlagsWithPrefix(prefix+"service.", f) c.ServiceClientConfig.RegisterFlagsWithPrefix(prefix, f) @@ -263,8 +263,9 @@ func (a *Agent) ApplyConfig(cfg Config) error { if err != nil { return err } - model.DefaultNameEscapingScheme = scheme + model.NameEscapingScheme = scheme } + level.Info(a.logger).Log("msg", "escaping scheme", "scheme", model.NameEscapingScheme.String()) if a.cleaner != nil { a.cleaner.Stop()