diff --git a/go.mod b/go.mod index aa083df1..c8fe08da 100644 --- a/go.mod +++ b/go.mod @@ -12,10 +12,10 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 github.com/prometheus/client_golang v1.20.4 github.com/prometheus/client_model v0.6.1 - github.com/prometheus/common v0.59.1 - github.com/prometheus/exporter-toolkit v0.12.0 + github.com/prometheus/common v0.60.0 + github.com/prometheus/exporter-toolkit v0.13.0 github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 - google.golang.org/protobuf v1.34.2 + google.golang.org/protobuf v1.35.1 ) require ( @@ -23,9 +23,9 @@ require ( github.com/mdlayher/socket v0.4.1 // indirect github.com/mdlayher/vsock v1.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect ) require ( @@ -42,7 +42,7 @@ require ( github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 5c70745d..5b828dae 100644 --- a/go.sum +++ b/go.sum @@ -53,10 +53,10 @@ github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zI github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= -github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= -github.com/prometheus/exporter-toolkit v0.12.0 h1:DkE5RcEZR3lQA2QD5JLVQIf41dFKNsVMXFhgqcif7fo= -github.com/prometheus/exporter-toolkit v0.12.0/go.mod h1:fQH0KtTn0yrrS0S82kqppRjDDiwMfIQUwT+RBRRhwUc= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/exporter-toolkit v0.13.0 h1:lmA0Q+8IaXgmFRKw09RldZmZdnvu9wwcDLIXGmTPw1c= +github.com/prometheus/exporter-toolkit v0.13.0/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/prometheus v0.54.1 h1:vKuwQNjnYN2/mDoWfHXDhAsz/68q/dQDb+YbcEqU7MQ= @@ -78,23 +78,23 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/handler/delete.go b/handler/delete.go index c4b963a4..f6901411 100644 --- a/handler/delete.go +++ b/handler/delete.go @@ -15,11 +15,10 @@ package handler import ( "fmt" + "log/slog" "net/http" "time" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/common/route" "github.com/prometheus/pushgateway/storage" @@ -28,7 +27,7 @@ import ( // Delete returns a handler that accepts delete requests. // // The returned handler is already instrumented for Prometheus. -func Delete(ms storage.MetricStore, jobBase64Encoded bool, logger log.Logger) func(http.ResponseWriter, *http.Request) { +func Delete(ms storage.MetricStore, jobBase64Encoded bool, logger *slog.Logger) func(http.ResponseWriter, *http.Request) { instrumentedHandler := InstrumentWithCounter( "delete", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -37,7 +36,7 @@ func Delete(ms storage.MetricStore, jobBase64Encoded bool, logger log.Logger) fu var err error if job, err = decodeBase64(job); err != nil { http.Error(w, fmt.Sprintf("invalid base64 encoding in job name %q: %v", job, err), http.StatusBadRequest) - level.Debug(logger).Log("msg", "invalid base64 encoding in job name", "job", job, "err", err.Error()) + logger.Debug("msg", "invalid base64 encoding in job name", "job", job, "err", err.Error()) return } } @@ -45,12 +44,12 @@ func Delete(ms storage.MetricStore, jobBase64Encoded bool, logger log.Logger) fu labels, err := splitLabels(labelsString) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) - level.Debug(logger).Log("msg", "failed to parse URL", "url", labelsString, "err", err.Error()) + logger.Debug("msg", "failed to parse URL", "url", labelsString, "err", err.Error()) return } if job == "" { http.Error(w, "job name is required", http.StatusBadRequest) - level.Debug(logger).Log("msg", "job name is required") + logger.Debug("msg", "job name is required") return } labels["job"] = job diff --git a/handler/push.go b/handler/push.go index f6eef1aa..65bf84fb 100644 --- a/handler/push.go +++ b/handler/push.go @@ -17,13 +17,12 @@ import ( "encoding/base64" "fmt" "io" + "log/slog" "mime" "net/http" "strings" "time" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/matttproud/golang_protobuf_extensions/pbutil" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/expfmt" @@ -58,7 +57,7 @@ var ( func Push( ms storage.MetricStore, replace, check, jobBase64Encoded bool, - logger log.Logger, + logger *slog.Logger, ) func(http.ResponseWriter, *http.Request) { handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { job := route.Param(r.Context(), "job") @@ -66,7 +65,7 @@ func Push( var err error if job, err = decodeBase64(job); err != nil { http.Error(w, fmt.Sprintf("invalid base64 encoding in job name %q: %v", job, err), http.StatusBadRequest) - level.Debug(logger).Log("msg", "invalid base64 encoding in job name", "job", job, "err", err.Error()) + logger.Debug("msg", "invalid base64 encoding in job name", "job", job, "err", err.Error()) return } } @@ -74,12 +73,12 @@ func Push( labels, err := splitLabels(labelsString) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) - level.Debug(logger).Log("msg", "failed to parse URL", "url", labelsString, "err", err.Error()) + logger.Debug("msg", "failed to parse URL", "url", labelsString, "err", err.Error()) return } if job == "" { http.Error(w, "job name is required", http.StatusBadRequest) - level.Debug(logger).Log("msg", "job name is required") + logger.Debug("msg", "job name is required") return } labels["job"] = job @@ -109,7 +108,7 @@ func Push( } if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) - level.Debug(logger).Log("msg", "failed to parse text", "source", r.RemoteAddr, "err", err.Error()) + logger.Debug("msg", "failed to parse text", "source", r.RemoteAddr, "err", err.Error()) return } now := time.Now() @@ -144,7 +143,7 @@ func Push( http.StatusBadRequest, ) } - level.Error(logger).Log( + logger.Error( "msg", "pushed metrics are invalid or inconsistent with existing metrics", "method", r.Method, "source", r.RemoteAddr, diff --git a/handler/status.go b/handler/status.go index c26b7b7e..31f3b264 100644 --- a/handler/status.go +++ b/handler/status.go @@ -19,13 +19,11 @@ import ( "html" "html/template" "io" + "log/slog" "net/http" "strconv" "time" - "github.com/go-kit/log" - "github.com/go-kit/log/level" - dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/version" "github.com/prometheus/pushgateway/histogram" @@ -58,7 +56,7 @@ func Status( root http.FileSystem, flags map[string]string, pathPrefix string, - logger log.Logger, + logger *slog.Logger, ) http.Handler { birth := time.Now() return InstrumentWithCounter( @@ -90,20 +88,20 @@ func Status( f, err := root.Open("template.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) - level.Error(logger).Log("msg", "error loading template.html", "err", err.Error()) + logger.Error("msg", "error loading template.html", "err", err.Error()) return } defer f.Close() tpl, err := io.ReadAll(f) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) - level.Error(logger).Log("msg", "error reading template.html", "err", err.Error()) + logger.Error("msg", "error reading template.html", "err", err.Error()) return } _, err = t.Parse(string(tpl)) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) - level.Error(logger).Log("msg", "error parsing template", "err", err.Error()) + logger.Error("msg", "error parsing template", "err", err.Error()) return } diff --git a/main.go b/main.go index 934f9893..f78204ad 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ import ( "context" "fmt" "io" + "log/slog" "net/http" "net/http/pprof" "net/url" @@ -33,35 +34,29 @@ import ( "github.com/go-kit/log/level" "github.com/golang/snappy" "github.com/prometheus/client_golang/prometheus" - versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/model" - "github.com/prometheus/common/promlog" + "github.com/prometheus/common/promslog" "github.com/prometheus/common/route" "github.com/prometheus/common/version" "github.com/prometheus/exporter-toolkit/web" - webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" + versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version" dto "github.com/prometheus/client_model/go" - promlogflag "github.com/prometheus/common/promlog/flag" + promslogflag "github.com/prometheus/common/promslog/flag" + webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" - api_v1 "github.com/prometheus/pushgateway/api/v1" "github.com/prometheus/pushgateway/asset" "github.com/prometheus/pushgateway/handler" "github.com/prometheus/pushgateway/storage" + + api_v1 "github.com/prometheus/pushgateway/api/v1" ) func init() { prometheus.MustRegister(versioncollector.NewCollector("pushgateway")) } -// logFunc in an adaptor to plug gokit logging into promhttp.HandlerOpts. -type logFunc func(...interface{}) error - -func (lf logFunc) Println(v ...interface{}) { - lf("msg", fmt.Sprintln(v...)) -} - func main() { var ( app = kingpin.New(filepath.Base(os.Args[0]), "The Pushgateway").UsageWriter(os.Stdout) @@ -75,22 +70,22 @@ func main() { persistenceInterval = app.Flag("persistence.interval", "The minimum interval at which to write out the persistence file.").Default("5m").Duration() pushUnchecked = app.Flag("push.disable-consistency-check", "Do not check consistency of pushed metrics. DANGEROUS.").Default("false").Bool() pushUTF8Names = app.Flag("push.enable-utf8-names", "Allow UTF-8 characters in metric and label names.").Default("false").Bool() - promlogConfig = promlog.Config{} + promlogConfig = promslog.Config{} ) - promlogflag.AddFlags(app, &promlogConfig) + promslogflag.AddFlags(app, &promlogConfig) app.Version(version.Print("pushgateway")) app.HelpFlag.Short('h') kingpin.MustParse(app.Parse(os.Args[1:])) - logger := promlog.New(&promlogConfig) + logger := promslog.New(&promlogConfig) *routePrefix = computeRoutePrefix(*routePrefix, *externalURL) externalPathPrefix := computeRoutePrefix("", *externalURL) - level.Info(logger).Log("msg", "starting pushgateway", "version", version.Info()) - level.Info(logger).Log("build_context", version.BuildContext()) - level.Debug(logger).Log("msg", "external URL", "url", *externalURL) - level.Debug(logger).Log("msg", "path prefix used externally", "path", externalPathPrefix) - level.Debug(logger).Log("msg", "path prefix for internal routing", "path", *routePrefix) + logger.Info("msg", "starting pushgateway", "version", version.Info()) + logger.Info("build_context", version.BuildContext()) + logger.Debug("msg", "external URL", "url", *externalURL) + logger.Debug("msg", "path prefix used externally", "path", externalPathPrefix) + logger.Debug("msg", "path prefix for internal routing", "path", *routePrefix) // flags is used to show command line flags on the status page. // Kingpin default flags are excluded as they would be confusing. @@ -124,7 +119,7 @@ func main() { r.Get( path.Join(*routePrefix, *metricsPath), promhttp.HandlerFor(g, promhttp.HandlerOpts{ - ErrorLog: logFunc(level.Error(logger).Log), + ErrorLog: slog.NewLogLogger(logger.Handler(), slog.LevelError), }).ServeHTTP, ) diff --git a/storage/diskmetricstore.go b/storage/diskmetricstore.go index 462c9912..a89b9322 100644 --- a/storage/diskmetricstore.go +++ b/storage/diskmetricstore.go @@ -17,6 +17,7 @@ import ( "encoding/gob" "errors" "fmt" + "log/slog" "os" "path" "sort" @@ -24,13 +25,11 @@ import ( "sync" "time" - "github.com/go-kit/log" - "github.com/go-kit/log/level" - //nolint:staticcheck // Ignore SA1019. Dependencies use the deprecated package, so we have to, too. "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "github.com/prometheus/common/promslog" dto "github.com/prometheus/client_model/go" ) @@ -55,7 +54,7 @@ type DiskMetricStore struct { metricGroups GroupingKeyToMetricGroup persistenceFile string predefinedHelp map[string]string - logger log.Logger + logger *slog.Logger } type mfStat struct { @@ -80,7 +79,7 @@ func NewDiskMetricStore( persistenceFile string, persistenceInterval time.Duration, gatherPredefinedHelpFrom prometheus.Gatherer, - logger log.Logger, + logger *slog.Logger, ) *DiskMetricStore { // TODO: Do that outside of the constructor to allow the HTTP server to // serve /-/healthy and /-/ready earlier. @@ -93,12 +92,12 @@ func NewDiskMetricStore( logger: logger, } if err := dms.restore(); err != nil { - level.Error(logger).Log("msg", "could not load persisted metrics", "err", err) + logger.Error("msg", "could not load persisted metrics", "err", err) } if helpStrings, err := extractPredefinedHelpStrings(gatherPredefinedHelpFrom); err == nil { dms.predefinedHelp = helpStrings } else { - level.Error(logger).Log("msg", "could not gather metrics for predefined help strings", "err", err) + logger.Error("msg", "could not gather metrics for predefined help strings", "err", err) } go dms.loop(persistenceInterval) @@ -126,7 +125,7 @@ func (dms *DiskMetricStore) Healthy() error { // considered as healthy. if len(dms.writeQueue) == cap(dms.writeQueue) { err := fmt.Errorf("write queue is full") - level.Warn(dms.logger).Log("msg", err) + dms.logger.Warn("msg", err) return err } @@ -150,7 +149,7 @@ func (dms *DiskMetricStore) GetMetricFamilies() []*dto.MetricFamily { for name, tmf := range group.Metrics { mf := tmf.GetMetricFamily() if mf == nil { - level.Warn(dms.logger).Log("msg", "storage corruption detected, consider wiping the persistence file") + dms.logger.Warn("msg", "storage corruption detected, consider wiping the persistence file") continue } stat, exists := mfStatByName[name] @@ -165,7 +164,7 @@ func (dms *DiskMetricStore) GetMetricFamilies() []*dto.MetricFamily { result[stat.pos] = existingMF } if mf.GetHelp() != existingMF.GetHelp() { - level.Info(dms.logger).Log("msg", "metric families inconsistent help strings", "err", "Metric families have inconsistent help strings. The latter will have priority. This is bad. Fix your pushed metrics!", "new", mf, "old", existingMF) + dms.logger.Info("msg", "metric families inconsistent help strings", "err", "Metric families have inconsistent help strings. The latter will have priority. This is bad. Fix your pushed metrics!", "new", mf, "old", existingMF) } // Type inconsistency cannot be fixed here. We will detect it during // gathering anyway, so no reason to log anything here. @@ -173,7 +172,7 @@ func (dms *DiskMetricStore) GetMetricFamilies() []*dto.MetricFamily { } else { copied := false if help, ok := dms.predefinedHelp[name]; ok && mf.GetHelp() != help { - level.Info(dms.logger).Log("msg", "metric families overlap", "err", "Metric family has the same name as a metric family used by the Pushgateway itself but it has a different help string. Changing it to the standard help string. This is bad. Fix your pushed metrics!", "metric_family", mf, "standard_help", help) + dms.logger.Info("msg", "metric families overlap", "err", "Metric family has the same name as a metric family used by the Pushgateway itself but it has a different help string. Changing it to the standard help string. This is bad. Fix your pushed metrics!", "metric_family", mf, "standard_help", help) mf = copyMetricFamily(mf) copied = true mf.Help = proto.String(help) @@ -218,9 +217,9 @@ func (dms *DiskMetricStore) loop(persistenceInterval time.Duration) { func() { persistStarted := time.Now() if err := dms.persist(); err != nil { - level.Error(dms.logger).Log("msg", "error persisting metrics", "err", err) + dms.logger.Error("msg", "error persisting metrics", "err", err) } else { - level.Info(dms.logger).Log("msg", "metrics persisted", "file", dms.persistenceFile) + dms.logger.Info("msg", "metrics persisted", "file", dms.persistenceFile) } persistDone <- persistStarted }, @@ -381,7 +380,7 @@ func (dms *DiskMetricStore) checkWriteRequest(wr WriteRequest) bool { tdms := &DiskMetricStore{ metricGroups: dms.GetMetricFamiliesMap(), predefinedHelp: dms.predefinedHelp, - logger: log.NewNopLogger(), + logger: promslog.NewNopLogger(), } tdms.processWriteRequest(wr)