From 6f63d4c0b77dd2884ff248af9825daabb6cee3f8 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Thu, 1 Feb 2024 14:00:15 +0530 Subject: [PATCH] Bug 2242324: avoid fetching performance metrics from mgr/prometheus Avoid fetching performance counters of ceph daemons in prometheus module by setting `exclude_perf_counters` to true, given ceph-exporter takes of it in 4.14 Signed-off-by: Avan Thakkar --- pkg/operator/ceph/cluster/mgr/mgr.go | 6 ++++++ pkg/operator/ceph/cluster/mgr/mgr_test.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/operator/ceph/cluster/mgr/mgr.go b/pkg/operator/ceph/cluster/mgr/mgr.go index f72db4b1ed17..99e0c579d56e 100644 --- a/pkg/operator/ceph/cluster/mgr/mgr.go +++ b/pkg/operator/ceph/cluster/mgr/mgr.go @@ -400,6 +400,12 @@ func (c *Cluster) configurePrometheusModule() error { logger.Infof("prometheus config will change, interval: %v", interval) } + // Disable fetching of performance counters from the prometheus exporter as ceph-exporter is enabled for 4.14 + err = monStore.Set("mgr", "mgr/prometheus/exclude_perf_counters", "true") + if err != nil { + return errors.Wrapf(err, "failed to enable exclude_perf_counters") + } + if portHasChanged || intervalHasChanged { logger.Info("prometheus config has changed. restarting the prometheus module") return c.restartMgrModule(PrometheusModuleName) diff --git a/pkg/operator/ceph/cluster/mgr/mgr_test.go b/pkg/operator/ceph/cluster/mgr/mgr_test.go index b161bd1619a8..515041f44356 100644 --- a/pkg/operator/ceph/cluster/mgr/mgr_test.go +++ b/pkg/operator/ceph/cluster/mgr/mgr_test.go @@ -513,7 +513,7 @@ func TestCluster_configurePrometheusModule(t *testing.T) { assert.Equal(t, 2, modulesEnabled) assert.Equal(t, 1, modulesDisabled) assert.Equal(t, "30001", configSettings["mgr/prometheus/server_port"]) - assert.Equal(t, 1, len(configSettings)) + assert.Equal(t, 2, len(configSettings)) modulesEnabled = 0 modulesDisabled = 0 @@ -527,7 +527,7 @@ func TestCluster_configurePrometheusModule(t *testing.T) { assert.Equal(t, 2, modulesEnabled) assert.Equal(t, 1, modulesDisabled) assert.Equal(t, "30001", configSettings["mgr/prometheus/server_port"]) - assert.Equal(t, 1, len(configSettings)) + assert.Equal(t, 2, len(configSettings)) // Enable prometheus module, port and interval changed modulesEnabled = 0