Don't register metrics unless on leading master

This commit is contained in:
Aleksandra Malinowska 2017-12-14 15:58:18 +01:00
parent 6b9c9ecb11
commit 312f989c15
2 changed files with 3 additions and 1 deletions

View File

@ -233,6 +233,7 @@ func registerSignalHandlers(autoscaler core.Autoscaler) {
}
func run(healthCheck *metrics.HealthCheck) {
metrics.RegisterAll()
kubeClient := createKubeClient()
kubeEventRecorder := kube_util.CreateEventRecorder(kubeClient)
opts := createAutoscalerOptions()

View File

@ -212,7 +212,8 @@ var (
)
)
func init() {
// RegisterAll registers all metrics.
func RegisterAll() {
prometheus.MustRegister(clusterSafeToAutoscale)
prometheus.MustRegister(nodesCount)
prometheus.MustRegister(nodeGroupsCount)