Skip to content

Commit

Permalink
fix: Add missing job selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
adinhodovic committed Nov 14, 2024
1 parent 3cece28 commit 9c12f23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions dashboards/opencost-namespace.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,17 @@ local pieQueryOptions = pieChartPanel.queryOptions;
local openCostPodMonthlyCostQuery = |||
topk(10,
sum(
sum(container_memory_allocation_bytes{job=~"$job", namespace=~"$namespace"}) by (instance, pod)
sum(container_memory_allocation_bytes{namespace=~"$namespace", job=~"$job"}) by (instance, pod)
* on(instance) group_left() (
node_ram_hourly_cost / 1024 / 1024 / 1024 * 730
node_ram_hourly_cost{job=~"$job"} / 1024 / 1024 / 1024 * 730
+ on(node, instance_type) group_left()
label_replace
(
kube_node_labels{job=~"$job"}, "instance_type", "$1", "label_node_kubernetes_io_instance_type", "(.*)"
) * 0
)
+
sum(container_cpu_allocation{job=~"$job", namespace=~"$namespace"}) by (instance, pod)
sum(container_cpu_allocation{namespace=~"$namespace", job=~"$job"}) by (instance, pod)
* on(instance) group_left() (
node_cpu_hourly_cost{job=~"$job"} * 730
+ on(node,instance_type) group_left()
Expand All @@ -403,8 +403,8 @@ local pieQueryOptions = pieChartPanel.queryOptions;
)
|||,

local openCostPodMonthlyCostQueryOffset7d = std.strReplace(openCostPodMonthlyCostQuery, '{job=~"$job"}', '{job=~"$job"} offset 7d'),
local openCostPodMonthlyCostQueryOffset30d = std.strReplace(openCostPodMonthlyCostQuery, '{job=~"$job"}', '{job=~"$job"} offset 30d'),
local openCostPodMonthlyCostQueryOffset7d = std.strReplace(openCostPodMonthlyCostQuery, 'job=~"$job"}', 'job=~"$job"} offset 7d'),
local openCostPodMonthlyCostQueryOffset30d = std.strReplace(openCostPodMonthlyCostQuery, 'job=~"$job"}', 'job=~"$job"} offset 30d'),

local openCostPodTable =
tablePanel.new(
Expand Down Expand Up @@ -534,20 +534,20 @@ local pieQueryOptions = pieChartPanel.queryOptions;
local openCostContainerMonthlyCostQuery = |||
topk(10,
sum(
sum(container_memory_allocation_bytes{job=~"$job", namespace=~"$namespace"}) by (instance, container)
sum(container_memory_allocation_bytes{namespace=~"$namespace", job=~"$job"}) by (instance, container)
* on(instance) group_left() (
node_ram_hourly_cost / 1024 / 1024 / 1024 * 730
+ on(node,instance_type) group_left()
node_ram_hourly_cost{job=~"$job"} / 1024 / 1024 / 1024 * 730
+ on(node, instance_type) group_left()
label_replace
(
kube_node_labels{job=~"$job"}, "instance_type", "$1", "label_node_kubernetes_io_instance_type", "(.*)"
) * 0
)
+
sum(container_cpu_allocation{job=~"$job", namespace=~"$namespace"}) by (instance, container)
sum(container_cpu_allocation{namespace=~"$namespace", job=~"$job"}) by (instance, container)
* on(instance) group_left() (
node_cpu_hourly_cost{job=~"$job"} * 730
+ on(node,instance_type) group_left()
+ on(node, instance_type) group_left()
label_replace
(
kube_node_labels{job=~"$job"}, "instance_type", "$1", "label_node_kubernetes_io_instance_type", "(.*)"
Expand All @@ -557,8 +557,8 @@ local pieQueryOptions = pieChartPanel.queryOptions;
)
|||,

local openCostContainerMonthlyCostQueryOffset7d = std.strReplace(openCostContainerMonthlyCostQuery, '{job=~"$job"}', '{job=~"$job"} offset 7d'),
local openCostContainerMonthlyCostQueryOffset30d = std.strReplace(openCostContainerMonthlyCostQuery, '{job=~"$job"}', '{job=~"$job"} offset 30d'),
local openCostContainerMonthlyCostQueryOffset7d = std.strReplace(openCostContainerMonthlyCostQuery, 'job=~"$job"}', 'job=~"$job"} offset 7d'),
local openCostContainerMonthlyCostQueryOffset30d = std.strReplace(openCostContainerMonthlyCostQuery, 'job=~"$job"}', 'job=~"$job"} offset 30d'),

local openCostContainerTable =
tablePanel.new(
Expand Down
Loading

0 comments on commit 9c12f23

Please sign in to comment.