containers / prometheus-podman-exporter

Prometheus exporter for podman environments exposing containers, pods, images, volumes and networks information.
Apache License 2.0
140 stars 23 forks source link

add CPU percentage to prometheus info/output #292

Closed amsnek closed 1 month ago

amsnek commented 1 month ago

Is your feature request related to a problem? Please describe. Currently there only are values for podman_container_cpu_seconds_total and podman_container_started_seconds. While these can be used to convert to %cpu, this however requires additional computation and is not ideal for direct ingesting or graphing the data.

Describe the solution you'd like Having an an additional value for %cpu (percentage) similiar or identical to what podman stats does. -> convert podman_container_started_seconds to unix time -> calculate seconds since container start (runtime seconds) -> divide podman_container_cpu_seconds_total by runtime seconds is currently needed unless I am missing something obvious?

amsnek commented 1 month ago

never mind, I learned something new about rate() regarding prometheus today.