From 13a06e4adff639de16a21142a0ec61f09f036eed Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Tue, 17 Dec 2024 10:13:40 +0000 Subject: [PATCH] fix(dashboards): Graph mem usage w and w/o cache (#1001) --- dashboards/resources/node.libsonnet | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/dashboards/resources/node.libsonnet b/dashboards/resources/node.libsonnet index e70ffde5c..35282ef62 100644 --- a/dashboards/resources/node.libsonnet +++ b/dashboards/resources/node.libsonnet @@ -175,7 +175,7 @@ local var = g.dashboard.variable; }, ]), - tsPanel.new('Memory Usage (w/o cache)') + tsPanel.new('Memory Usage (w/cache)') + tsPanel.standardOptions.withUnit('bytes') + tsPanel.queryOptions.withTargets([ prometheus.new( @@ -202,6 +202,33 @@ local var = g.dashboard.variable; + fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] }), ]), + tsPanel.new('Memory Usage (w/o cache)') + + tsPanel.standardOptions.withUnit('bytes') + + tsPanel.queryOptions.withTargets([ + prometheus.new( + '${datasource}', + 'sum(kube_node_status_capacity{%(clusterLabel)s="$cluster", %(kubeStateMetricsSelector)s, node=~"$node", resource="memory"})' % $._config, + ) + + prometheus.withLegendFormat('max capacity'), + + prometheus.new( + '${datasource}', + 'sum(node_namespace_pod_container:container_memory_rss{%(clusterLabel)s="$cluster", node=~"$node", container!=""}) by (pod)' % $._config, + ) + + prometheus.withLegendFormat('{{pod}}'), + ]) + + tsPanel.fieldConfig.defaults.custom.withStacking({ mode: 'normal' }) + + tsPanel.standardOptions.withOverrides([ + fieldOverride.byName.new('max capacity') + + fieldOverride.byName.withPropertiesFromOptions( + timeSeries.standardOptions.color.withMode('fixed') + + timeSeries.standardOptions.color.withFixedColor('red') + ) + + fieldOverride.byName.withProperty('custom.stacking', { mode: 'none' }) + + fieldOverride.byName.withProperty('custom.hideFrom', { tooltip: true, viz: false, legend: false }) + + fieldOverride.byName.withProperty('custom.lineStyle', { fill: 'dash', dash: [10, 10] }), + ]), + table.new('Memory Quota') + table.standardOptions.withUnit('bytes') + table.queryOptions.withTargets([