I currently have the following Promql query which allow me to query the memory used by each of my K8S pods:
sum(container_memory_working_set_bytes{image!="",name=~"^k8s_.*"}) by (pod_name)
The pod's name is followed by a hash defined by K8S:
weave-net-kxpxc
weave-net-jjkki
weave-net-asdkk
Which all belongs to the same app: weave-net
What I would like is to aggregate the memory of all pods which belongs to the same app.
So, the query would sum the memory of all weave-net
pods and place the result in an app called weave
. Such as the result would be:
{pod_name="weave-net"} 10
instead of
{pod_name="weave-net-kxpxc"} 5
{pod_name="weave-net-jjkki"} 3
{pod_name="weave-net-asdkk"} 2
Is it even possible to do so, and if yes, how ?