lesaux / diamond-DockerContainerCollector

A diamond collector for docker containers
25 stars 12 forks source link

Docker Metrics large numbers #6

Open stevezau opened 8 years ago

stevezau commented 8 years ago

Hey,

Looking at the metrics being pushed to graphite it looks like they are all really long numbers.. ie cpu usage is like 150245784 which makes no sense to me.

Doing a little bit of research it appears you are meant to calc to differences between each stats stream? Or at least this is what the docker cli command does..

https://github.com/docker/docker/blob/0d445685b8d628a938790e50517f3fb949b300e0/api/client/stats.go#L199

shouldn't this be doing something similar rather then sending that really large number?

lesaux commented 8 years ago

Hello, this is what the diamond function publish_gauge does, as opposed to publish_counter. I remember having to publish a gauge for some of the network metrics, but not for any of the cpu ones. Maybe something changed in the docker stats api recently. I will take a look and let you know.

ywfluctier commented 6 years ago

Im also shocked at the big numbers. In cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CpuStats.CpuUsage.PercpuUsage)) * 100.0, it is kinda hard for me to comprehend len(v.CpuStats.CpuUsage.PercpuUsage). Is that ignorable?