Extrapolate further into the future
So far we have only extapolated as far into the future as we could look into the past. Everything beyond that was "infinity". Now we use the first and last observation to extrapolate beyond that.
This commit is contained in:
parent
2016fb4a0e
commit
c462ca4d80
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import statistics
|
import statistics
|
||||||
|
@ -53,6 +54,15 @@ class DiskFullPredictor:
|
||||||
log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", m, current_used_bytes, current_usable_bytes)
|
log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", m, current_used_bytes, current_usable_bytes)
|
||||||
tuf = now - lts.data[i][0]
|
tuf = now - lts.data[i][0]
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
# XXX - this is probably a range, so maybe we should use some kind
|
||||||
|
# of average. It might also be zero, so maybe we have to search for
|
||||||
|
# the first non-zero value? For now keep it simple.
|
||||||
|
first_used_bytes = lts.data[0][1]
|
||||||
|
historic_growth = current_used_bytes / first_used_bytes
|
||||||
|
future_growth = current_usable_bytes / current_used_bytes
|
||||||
|
tuf = math.log(future_growth) / math.log(historic_growth) * (now - lts.data[0][0])
|
||||||
|
tuf = max(tuf, now - lts.data[0][0])
|
||||||
desc = {**lts.description,
|
desc = {**lts.description,
|
||||||
"measure": "time_until_disk_full",
|
"measure": "time_until_disk_full",
|
||||||
"node": node,
|
"node": node,
|
||||||
|
|
Loading…
Reference in New Issue