Skip to content

Commit

Permalink
Merge pull request #418 from kahowell/openshift_cpu_hours_instance_hours
Browse files Browse the repository at this point in the history
Add rules for cluster CPU-hours and Instance-hours
  • Loading branch information
openshift-merge-robot committed Sep 28, 2022
2 parents 320b9a9 + 9bb86a0 commit 8e8125e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions jsonnet/telemeter/rules.libsonnet
Expand Up @@ -130,6 +130,23 @@
topk(500, sum (acm_managed_cluster_info) by (managed_cluster_id, cloud, created_via, endpoint, instance, job, namespace, pod, service, vendor, version))
|||,
},
{
// OpenShift Cluster CPU-hours for the last hour.
// The divisor of scalar(count_over_time(vector(1)[1h:5m])) allows us to get an effective average value having "absent data" treated as 0.
// max(...) by (_id) is used ensure a single datapoint per cluster ID.
record: 'cluster:usage:workload:capacity_physical_cpu_hours',
expr: |||
max by(_id) (sum_over_time(cluster:usage:workload:capacity_physical_cpu_cores:max:5m[1h:5m]) / scalar(count_over_time(vector(1)[1h:5m])))
|||,
},
{
// OpenShift Cluster Instance-hours for the last hour.
// The divisor of scalar(count_over_time(vector(1)[1h:5m])) allows us to get an effective average value having "absent data" treated as 0.
record: 'cluster:usage:workload:capacity_physical_instance_hours',
expr: |||
max by(_id) (count_over_time(cluster:usage:workload:capacity_physical_cpu_cores:max:5m[1h:5m])) / scalar(count_over_time(vector(1)[1h:5m]))
|||,
},
],
},
],
Expand Down

0 comments on commit 8e8125e

Please sign in to comment.