From 6416061db74ea806bd5140f4f48359af1029f981 Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Thu, 9 May 2024 10:15:30 +0100 Subject: [PATCH] refactor: break subquery into recording rule Signed-off-by: Philip Gough --- contrib/prometheus/recording-rules-resource.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/prometheus/recording-rules-resource.yml b/contrib/prometheus/recording-rules-resource.yml index a6e939c..abf7262 100644 --- a/contrib/prometheus/recording-rules-resource.yml +++ b/contrib/prometheus/recording-rules-resource.yml @@ -12,10 +12,17 @@ objects: spec: groups: - name: host-metering - interval: 30m + interval: 10m limit: 0 rules: - - record: host:usage:workload:cpu_hours1h - expr: max by(_id) (sum_over_time(system_cpu_logical_count[1h:10m])) / scalar(count_over_time(vector(1)[1h:10m])) + - record: min_system_cpu_logical_count:10m + expr: | + min_over_time( + system_cpu_logical_count{ + product=~".*(^|,)(204)($|,).*", + billing_model="marketplace", + support=~"Premium|Standard|Self-Support|None|" + }[10m] + ) labels: rulesVersion: v0