Skip to content

Commit

Permalink
Merge pull request grafana/cortex-jsonnet#229 from grafana/fix-memory…
Browse files Browse the repository at this point in the history
…-panels

Fixed workingset memory panel while rolling out a StatefulSet
  • Loading branch information
pracucci authored Dec 14, 2020
2 parents dea186e + ba803b9 commit e51f024
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerMemoryWorkingSetPanel(title, containerName)::
$.panel(title) +
$.queryPanel([
'sum by(pod) (container_memory_working_set_bytes{%s,container="%s"})' % [$.namespaceMatcher(), containerName],
// We use "max" instead of "sum" otherwise during a rolling update of a statefulset we will end up
// summing the memory of the old pod (whose metric will be stale for 5m) to the new pod.
'max by(pod) (container_memory_working_set_bytes{%s,container="%s"})' % [$.namespaceMatcher(), containerName],
'min(container_spec_memory_limit_bytes{%s,container="%s"} > 0)' % [$.namespaceMatcher(), containerName],
], ['{{pod}}', 'limit']) +
{
Expand Down

0 comments on commit e51f024

Please sign in to comment.