Discard stale information from DiskIO and NetworkIO meters

This ensures the initial read of the data is not misinterpreted as arbitrarily large values.
Also this forces the maximum update interval between two subsequent reads to within 30s.

Fixes #860
This commit is contained in:
Benny Baumann 2021-10-30 10:57:14 +02:00
parent 696f79fe50
commit 2977414d54
2 changed files with 12 additions and 0 deletions

View File

@ -81,6 +81,12 @@ static void DiskIOMeter_updateValues(Meter* this) {
cached_msTimeSpend_total = data.totalMsTimeSpend;
}
if (passedTimeInMs > 30000) {
// Triggers for the first initialization and
// when there was a long time we did not collect updates
hasData = false;
}
this->values[0] = cached_utilisation_diff;
this->total = MAXIMUM(this->values[0], 100.0); /* fix total after (initial) spike */

View File

@ -85,6 +85,12 @@ static void NetworkIOMeter_updateValues(Meter* this) {
cached_txp_total = data.packetsTransmitted;
}
if (passedTimeInMs > 30000) {
// Triggers for the first initialization and
// when there was a long time we did not collect updates
hasData = false;
}
this->values[0] = cached_rxb_diff;
this->values[1] = cached_txb_diff;
if (cached_rxb_diff + cached_txb_diff > this->total) {