diff --git a/.golangci.yml b/.golangci.yml index 76c40c792..642cf45c8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,7 +22,6 @@ linters-settings: packages-with-error-message: - sync/atomic: "Use go.uber.org/atomic instead of sync/atomic" - github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" - # Temporarily commenting until a solution for removing it from klog is found. - # - github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" + - github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" errcheck: exclude: scripts/errcheck_excludes.txt diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 2e93976e8..94b63882c 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -35,7 +35,6 @@ import ( "time" "github.com/alecthomas/units" - kitloglevel "github.com/go-kit/kit/log/level" "github.com/go-kit/log" "github.com/go-kit/log/level" conntrack "github.com/mwitkow/go-conntrack" @@ -420,27 +419,11 @@ func main() { noStepSubqueryInterval := &safePromQLNoStepSubqueryInterval{} noStepSubqueryInterval.Set(config.DefaultGlobalConfig.EvaluationInterval) - // FIXME: Temporary workaround until a proper solution is found. go-kit's - // level packages use private types to determine the level so we have to use - // the same level package as the underlying library. - var lvl kitloglevel.Option - switch cfg.promlogConfig.Level.String() { - case "debug": - lvl = kitloglevel.AllowDebug() - case "info": - lvl = kitloglevel.AllowInfo() - case "warn": - lvl = kitloglevel.AllowWarn() - case "error": - lvl = kitloglevel.AllowError() - } - kloglogger := kitloglevel.NewFilter(logger, lvl) - // Above level 6, the k8s client would log bearer tokens in clear-text. klog.ClampLevel(6) - klog.SetLogger(log.With(kloglogger, "component", "k8s_client_runtime")) + klog.SetLogger(log.With(logger, "component", "k8s_client_runtime")) klogv2.ClampLevel(6) - klogv2.SetLogger(log.With(kloglogger, "component", "k8s_client_runtime")) + klogv2.SetLogger(log.With(logger, "component", "k8s_client_runtime")) level.Info(logger).Log("msg", "Starting Prometheus", "version", version.Info()) if bits.UintSize < 64 { diff --git a/go.mod b/go.mod index e9925980f..498cc4872 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/edsrzf/mmap-go v1.0.0 github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d github.com/envoyproxy/protoc-gen-validate v0.1.0 - github.com/go-kit/kit v0.10.0 github.com/go-kit/log v0.1.0 github.com/go-logfmt/logfmt v0.5.0 github.com/go-openapi/strfmt v0.20.1 @@ -80,7 +79,7 @@ require ( replace ( k8s.io/klog => github.com/simonpasquier/klog-gokit v0.3.0 - k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v2 v2.1.0 + k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v3 v3.0.0 ) // Exclude linodego v1.0.0 as it is no longer published on github. diff --git a/go.sum b/go.sum index fd9bc1d3c..dc7d0db2a 100644 --- a/go.sum +++ b/go.sum @@ -1145,8 +1145,8 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvq github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/simonpasquier/klog-gokit v0.3.0 h1:TkFK21cbwDRS+CiystjqbAiq5ubJcVTk9hLUck5Ntcs= github.com/simonpasquier/klog-gokit v0.3.0/go.mod h1:+SUlDQNrhVtGt2FieaqNftzzk8P72zpWlACateWxA9k= -github.com/simonpasquier/klog-gokit/v2 v2.1.0 h1:EaXk8kgWawwPbRZwaEiijU/lE2s6eD3MCwy5usW3Jgw= -github.com/simonpasquier/klog-gokit/v2 v2.1.0/go.mod h1:VgeTFrwzYYcMH8edEfh3/ai2j/Yg8c/qIm1bkGkhuJg= +github.com/simonpasquier/klog-gokit/v3 v3.0.0 h1:J0QrVhAULISHWN05PeXX/xMqJBjnpl2fAuO8uHdQGsA= +github.com/simonpasquier/klog-gokit/v3 v3.0.0/go.mod h1:+WRhGy707Lp2Q4r727m9Oc7FxazOHgW76FIyCr23nus= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=