forta-network / forta-node

Scan Node software for the Forta Network
https://forta.org
Other
79 stars 151 forks source link

Calculate docker cpu percentage #859

Closed dkeysil closed 6 months ago

dkeysil commented 6 months ago

This is calculation function from the docker library - https://github.com/moby/moby/blob/eb131c5383db8cac633919f82abad86c99bffbe5/cli/command/container/stats_helpers.go#L175-L188

It calculates CPU usage as percentage

Right now this metric (resources.docker.cpu) is not really helpful because cpu.TotalUsage is always increasing.