From c462ca4d8067590640b769e488ed825937e30c36 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 7 Sep 2024 12:01:20 +0200 Subject: [PATCH] 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. --- process_queue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/process_queue b/process_queue index 3510ae2..c1973e8 100644 --- a/process_queue +++ b/process_queue @@ -2,6 +2,7 @@ import logging import logging.config +import math import os import socket 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) tuf = now - lts.data[i][0] 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, "measure": "time_until_disk_full", "node": node,