spaghetti- / podman_prometheus_exporter

4 stars 3 forks source link

Add label for pod #4

Open SckyzO opened 3 years ago

SckyzO commented 3 years ago

I would like to not show "pod" in my grafana when i display podman_memusage for example, but all containers and pods are display. Do you think it is possible to another label for best matching ? For example :

before

podman_memusage{id="xxx", instance="node:9901", job="podman_container", name="gitlab_redis"}  59428864
podman_memusage{id="yyy", instance="node:9901", job="podman_container", name="ac7f342420bf-infra"}  1380352
podman_memusage{id="zzz", instance="node:9901", job="podman_container", name="gitlab_app"}  3274252288
podman_memusage{id="xyz", instance="node:9901", job="podman_container", name="gitlab_db"}  150040576

after

podman_memusage{id="xxx", instance="node:9901", job="podman_container", name="gitlab_redis",pod="false"} 
 59428864
podman_memusage{id="yyy", instance="node:9901", job="podman_container", name="ac7f342420bf-infra",pod="true"} 
 1380352
podman_memusage{id="zzz", instance="node:9901", job="podman_container", name="gitlab_app",pod="false"} 
 3274252288
podman_memusage{id="xyz", instance="node:9901", job="podman_container", name="gitlab_db",pod="false"} 
 150040576

Regards,

Madic- commented 3 years ago

I'm not sure what you want. What do you mean with "pod"?

SckyzO commented 3 years ago

When you use a docker-compose (podman-compose) for create containers, you create a POD and in this pod you have your containers. But this pod is show as containers with this exporter. but a pod is not a container, is an aggregate of containers.

do you know what i mean ?

https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods

spaghetti- commented 3 years ago

Thanks for the explanation, from looking through the available container information at https://github.com/containers/podman/blob/v2.2.1/libpod/define/containerstate.go#L117 that's not a field. It maybe possible to get this information by cross referencing it with some other API though.