Find min/max/average memory used by pod using promethus

Viewed 241

I am trying to find min/max/average memory consumed by particular pod over a time inteval.

Currently I am using

sum(container_memory_working_set_bytes{namespace="test", pod="test1", container!="POD", container!=""}) by (container)

Output -> test1 = 9217675264

For report purpose, I need to find what the min/peak memory used by pod over a time interval ( 6h) and average too.

1 Answers

You can do that with a range vector (add an [interval] to a metric name/selector) and an aggregation-over-time function:

min_over_time(container_memory_usage_bytes{}[6h])
max_over_time(container_memory_usage_bytes{}[6h])
avg_over_time(container_memory_usage_bytes{}[6h])
Related