mirror of
https://github.com/rancher/norman.git
synced 2025-09-01 15:18:20 +00:00
Default to noop metric provider
With the built in prom. metrics provider, the k8s machinery doesnt deregister metrics when controllers are removed. So over time as things like clusters are created or removed the metrics are not cleaned up. The metrics types for the cache and queue are also very large. They can take ~1GB of RAM in a 100 cluster setup. Also, Rancher is not exposing these stats so they are unobservable.
This commit is contained in:
@@ -3,6 +3,7 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -22,10 +23,19 @@ import (
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
)
|
||||
|
||||
const MetricsEnv = "NORMAN_QUEUE_METRICS"
|
||||
|
||||
var (
|
||||
resyncPeriod = 2 * time.Hour
|
||||
)
|
||||
|
||||
// Override the metrics providers
|
||||
func init() {
|
||||
if os.Getenv(MetricsEnv) != "true" {
|
||||
DisableAllControllerMetrics()
|
||||
}
|
||||
}
|
||||
|
||||
type HandlerFunc func(key string) error
|
||||
|
||||
type GenericController interface {
|
||||
|
Reference in New Issue
Block a user