From 61327fca687a31be5a70b3cda184bcc99a5c242b Mon Sep 17 00:00:00 2001 From: Quentin Bisson Date: Wed, 15 May 2024 14:01:24 +0200 Subject: [PATCH] Fix resource usage estimation (#1183) --- CHANGELOG.md | 4 ++++ .../monitoring.resource-usage-estimation.rules.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95e24cf97..e1de52c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix resource estimation recording rules for clusters that have more than 1 prometheus. + ## [3.14.0] - 2024-05-15 ### Added diff --git a/helm/prometheus-rules/templates/recording-rules/monitoring.resource-usage-estimation.rules.yaml b/helm/prometheus-rules/templates/recording-rules/monitoring.resource-usage-estimation.rules.yaml index 1f2973749..ed902952f 100644 --- a/helm/prometheus-rules/templates/recording-rules/monitoring.resource-usage-estimation.rules.yaml +++ b/helm/prometheus-rules/templates/recording-rules/monitoring.resource-usage-estimation.rules.yaml @@ -9,7 +9,7 @@ spec: groups: - name: monitoring.resource-usage-estimation.recording rules: - - expr: (count({__name__=~".+"}) by (cluster_id, job) / on(cluster_id) group_left prometheus_tsdb_head_series) * on(cluster_id) group_left sum(container_memory_usage_bytes{container="prometheus"}) by (cluster_id) + - expr: (count({__name__=~".+"}) by (cluster_id, job) / on(cluster_id) group_left prometheus_tsdb_head_series{instance="localhost:9090"}) * on(cluster_id) group_left sum(container_memory_usage_bytes{container="prometheus", namespace="kube-system"}) by (cluster_id) record: giantswarm:observability:monitoring:resource_usage_estimation:memory_usage_bytes - - expr: (count({__name__=~".+"}) by (cluster_id, job) / on(cluster_id) group_left prometheus_tsdb_head_series) * on(cluster_id) group_left sum(container_memory_working_set_bytes{container="prometheus"}) by (cluster_id) + - expr: (count({__name__=~".+"}) by (cluster_id, job) / on(cluster_id) group_left prometheus_tsdb_head_series{instance="localhost:9090"}) * on(cluster_id) group_left sum(container_memory_working_set_bytes{container="prometheus", namespace="kube-system"}) by (cluster_id) record: giantswarm:observability:monitoring:resource_usage_estimation:memory_working_set_bytes