diff --git a/overlays/deploy/prometheusrule.yaml b/overlays/deploy/prometheusrule.yaml index 56655cc9..de87870b 100644 --- a/overlays/deploy/prometheusrule.yaml +++ b/overlays/deploy/prometheusrule.yaml @@ -11,5 +11,5 @@ spec: groups: - name: acm_managed_cluster_worker_cores.rules rules: - - expr: sum by (hub_cluster_id, managed_cluster_id) (acm_managed_cluster_worker_cores) - record: 'acm_managed_cluster_worker_cores:sum' + - expr: max by (hub_cluster_id, managed_cluster_id) (acm_managed_cluster_worker_cores) + record: 'acm_managed_cluster_worker_cores:max' diff --git a/overlays/test/http/prometheusrule.yaml b/overlays/test/http/prometheusrule.yaml index 6cdf7451..e5439546 100644 --- a/overlays/test/http/prometheusrule.yaml +++ b/overlays/test/http/prometheusrule.yaml @@ -12,5 +12,5 @@ spec: groups: - name: acm_managed_cluster_worker_cores.rules rules: - - expr: sum by (hub_cluster_id, managed_cluster_id) (acm_managed_cluster_worker_cores) - record: 'acm_managed_cluster_worker_cores:sum' + - expr: max by (hub_cluster_id, managed_cluster_id) (acm_managed_cluster_worker_cores) + record: 'acm_managed_cluster_worker_cores:max' diff --git a/test/functional/managedcluster_test.go b/test/functional/managedcluster_test.go index cac75ecd..debbbba2 100644 --- a/test/functional/managedcluster_test.go +++ b/test/functional/managedcluster_test.go @@ -547,7 +547,7 @@ var _ = Describe("ManagedCluster Metrics", func() { }) Context("acm_managed_cluster_worker_cores", func() { - ruleExpr := "sum(acm_managed_cluster_worker_cores)+by+(hub_cluster_id,managed_cluster_id)" + ruleExpr := "max(acm_managed_cluster_worker_cores)+by+(hub_cluster_id,managed_cluster_id)" AfterEach(func() { By("Query metrics by count(acm_managed_cluster_worker_cores) by (hub_cluster_id)", func() { @@ -582,7 +582,7 @@ var _ = Describe("ManagedCluster Metrics", func() { It("should get metric", func() { assertGetMetrics("acm_managed_cluster_worker_cores", clusterWorkerCoresResponse) - assertRecordingRule("acm_managed_cluster_worker_cores:sum", ruleExpr) + assertRecordingRule("acm_managed_cluster_worker_cores:max", ruleExpr) }) It("should reflect the change on the managed cluster", func() { @@ -595,7 +595,7 @@ var _ = Describe("ManagedCluster Metrics", func() { }) assertGetMetrics("acm_managed_cluster_worker_cores", clusterWorkerCoresUpdatedResponse) - assertRecordingRule("acm_managed_cluster_worker_cores:sum", ruleExpr) + assertRecordingRule("acm_managed_cluster_worker_cores:max", ruleExpr) }) }) })