diff --git a/controller/generic_controller.go b/controller/generic_controller.go index 9057ea8e..a7cf2e06 100644 --- a/controller/generic_controller.go +++ b/controller/generic_controller.go @@ -7,7 +7,6 @@ import ( errors2 "github.com/pkg/errors" "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/norman/metrics" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -58,12 +57,8 @@ func (g *genericController) AddHandler(ctx context.Context, name string, handler return obj, nil } logrus.Tracef("%s calling handler %s %s", g.name, name, key) - metrics.IncTotalHandlerExecution(g.name, name) result, err := handler(key, obj) runtimeObject, _ := result.(runtime.Object) - if err != nil && !ignoreError(err, false) { - metrics.IncTotalHandlerFailure(g.name, name, key) - } if _, ok := err.(*ForgetError); ok { logrus.Tracef("%v %v completed with dropped err: %v", g.name, key, err) return runtimeObject, controller.ErrIgnore diff --git a/metrics/generic_controller.go b/metrics/generic_controller.go deleted file mode 100644 index 23adf42b..00000000 --- a/metrics/generic_controller.go +++ /dev/null @@ -1,47 +0,0 @@ -package metrics - -import ( - "github.com/prometheus/client_golang/prometheus" -) - -var ( - TotalHandlerExecution = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Subsystem: "norman_generic_controller", - Name: "total_handler_execution", - Help: "Total count of hanlder executions", - }, - []string{"name", "handlerName"}, - ) - - TotalHandlerFailure = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Subsystem: "norman_generic_controller", - Name: "total_handler_failure", - Help: "Total count of handler failures", - }, - []string{"name", "handlerName", "key"}, - ) -) - -func IncTotalHandlerExecution(controllerName, handlerName string) { - if prometheusMetrics { - TotalHandlerExecution.With( - prometheus.Labels{ - "name": controllerName, - "handlerName": handlerName}, - ).Inc() - } -} - -func IncTotalHandlerFailure(controllerName, handlerName, key string) { - if prometheusMetrics { - TotalHandlerFailure.With( - prometheus.Labels{ - "name": controllerName, - "handlerName": handlerName, - "key": key, - }, - ).Inc() - } -} diff --git a/metrics/register.go b/metrics/register.go deleted file mode 100644 index 2e857e70..00000000 --- a/metrics/register.go +++ /dev/null @@ -1,20 +0,0 @@ -package metrics - -import ( - "os" - - "github.com/prometheus/client_golang/prometheus" -) - -const metricsEnv = "CATTLE_PROMETHEUS_METRICS" - -var prometheusMetrics = false - -func init() { - if os.Getenv(metricsEnv) == "true" { - prometheusMetrics = true - // Generic controller metrics - prometheus.MustRegister(TotalHandlerExecution) - prometheus.MustRegister(TotalHandlerFailure) - } -} diff --git a/pkg/kwrapper/k8s/k3s.go b/pkg/kwrapper/k8s/k3s.go index 681621a7..afd013dd 100644 --- a/pkg/kwrapper/k8s/k3s.go +++ b/pkg/kwrapper/k8s/k3s.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package k8s