sys_metrics: reduce log level when measurement interval is shorter than expected

on highly loaded systems it can happen that the get_metrics() is called
twice within a few houndred milliseconds. Logging a warning in this
case isn't needed, so reduce to info.

on the other hand, 100ms might be to convervative. Patch also
lowers the smallest interval to 10ms
This commit is contained in:
Andre Puschmann 2021-06-30 19:42:54 +02:00
parent 4e39982a19
commit 0e6e3d201e
1 changed files with 3 additions and 3 deletions

View File

@ -69,9 +69,9 @@ sys_metrics_t sys_metrics_processor::get_metrics()
uint32_t measure_interval_ms =
std::chrono::duration_cast<std::chrono::milliseconds>(current_time - last_query_time).count();
// The time elapsed between 2 measures must be greater that 100 milliseconds.
if (measure_interval_ms < 100u) {
logger.warning("Interval less than 100ms, skipping measurement.");
// The time elapsed between 2 measures must be greater that 10 milliseconds.
if (measure_interval_ms < 10u) {
logger.info("Interval less than 10ms, skipping measurement.");
return create_null_metrics();
}