Skip to content

Conversation

@inqrphl
Copy link
Contributor

@inqrphl inqrphl commented Dec 19, 2025

Go psutil library was already reporting cpu idle time, take and expose it in the check.

Additionally, fix some of the bugs in the counter class, add getFirst() to get the earliest written value in the counter, add checkRetention() to check if the counter is designed to hold values with that much distance apart with its size.

Use these counter functions to return a nil result if the counter cannot fit the query range for check_cpu, even if it was extended. Like the case where user asks for 1 week of cpu utilization time when the counter can hold up to 1 hour.

Log information about the query range and the range recorded in the counters, and if the counter range is representative of the query. The check will return if the counter recorded cpu utilization in an interval no matter how small it is, but will complain if the recorded range is less than %50 of the query range in the logs.

Ahmet Oeztuerk added 3 commits December 19, 2025 14:20
- log error explanations before returning default values in cpu utilization
- WIP: wait during the cpu utilization check if the gathered points are not enough apart for the range. now the checks will return a valid value instead of zeros, causing problems rn
Add some more features in the counter class, it stores more values like
oldest, timesSet, retention and interval. Implement getFirst() and
checkRetention() functions and use them in the check_cpu_utilization.

Cpu utilization check can now detect if the maximum counter retention
time is too small for the query, or if the current counter interval
between earliest and the latest value is smaller than the interval. It
will also report and complain in the log if the counter search interval
being relatively smaller than the query interval.
fix typos and use range loops instead of loop variable
@inqrphl inqrphl changed the title CPU idle time in cpu utilization and CPU idle time in cpu utilization and counter improvements Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants