-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds CPU busy time and percentages #111
Conversation
return nil | ||
} | ||
|
||
func busyAndTotalCpuTime(t cpu.CPUTimesStat) (float64, float64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please document this function with a comment stating what the two float64 values are
@jpalay looks good I can merge once these few small things have been taken care of, and thank you for the thorough testing! |
} | ||
|
||
if totalDelta == 0 { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be continue
instead of return nil
, otherwise if we can't get percentages for one CPU then we get no stats at all for the rest.
I started working on some CPU things and wanted to get this in, so I went ahead and rebased it, made some small changes like those I commented on, and pushed thanks much @jpalay! |
Ok great, thanks! I also had some other thoughts about the CPU plugin, but I'll propose them in a separate PR |
The CPU plugin now collects the percentage of time the processor spends in various areas. It does this by remembering the CPU metrics it gathered the last time telegraf ran the plugin. It then looks at the difference between the current CPU metrics and the CPU metrics gathered last in order to determine how the CPU has spent its time.
Also, because InfluxDB 0.9 does not support adding together values from different series, I updated the CPU plugin to also collect one calculated metric, busy time, which is just the sum of all the CPU metrics besides the idle time.