Skip to content

Commit

Permalink
Usage of records definition instead of records itself (#1432)
Browse files Browse the repository at this point in the history
* feat(metrics): uses record definition instead of record name for node memory utilisation
* feat(metrics): uses record definition instead of record name for node cpu utilisation
  • Loading branch information
wrbbz authored Jun 14, 2024
1 parent 28eed8b commit 7001ddc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/robusta/core/playbooks/prometheus_enrichment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def create_resource_enrichment(
values_format=ChartValuesFormat.CPUUsage,
),
(ResourceChartResourceType.CPU, ResourceChartItemType.Node): ChartOptions(
query='instance:node_cpu_utilisation:rate5m{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} != 0',
query='1 - avg without (cpu) ( sum without (mode) (rate(node_cpu_seconds_total{job="node-exporter", instance=~"$node_internal_ip:[0-9]+", mode=~"idle|iowait|steal"}[5m]))) != 0',
values_format=ChartValuesFormat.Percentage,
),
(ResourceChartResourceType.CPU, ResourceChartItemType.Container): ChartOptions(
Expand All @@ -483,7 +483,7 @@ def create_resource_enrichment(
values_format=ChartValuesFormat.Bytes,
),
(ResourceChartResourceType.Memory, ResourceChartItemType.Node): ChartOptions(
query='instance:node_memory_utilisation:ratio{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} != 0',
query='1 - ((node_memory_MemAvailable_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} or (node_memory_Buffers_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} + node_memory_Cached_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} + node_memory_MemFree_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} + node_memory_Slab_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"} ) ) / node_memory_MemTotal_bytes{job="node-exporter", instance=~"$node_internal_ip:[0-9]+"}) != 0',
values_format=ChartValuesFormat.Percentage,
),
(ResourceChartResourceType.Memory, ResourceChartItemType.Container): ChartOptions(
Expand Down

0 comments on commit 7001ddc

Please sign in to comment.