Compare commits

..

No commits in common. "206be6a8fa9ac0c80715fea916d17060c3554f5e" and "a95ba6c51f7debd96389c2174362e1c84513d16f" have entirely different histories.

2 changed files with 8 additions and 14 deletions

View File

@ -139,13 +139,9 @@ class TimeSeries(Widget):
def v2y(v): def v2y(v):
if self.yscale == "log": if self.yscale == "log":
try: return (1 - math.log(v / min_value)
return (1 - math.log(max(v, min_value) / min_value) / math.log(max_value / min_value)
/ math.log(max_value / min_value) ) * 200
) * 200
except ValueError:
log.error(f"ValueError: v = {v}, min_value = {min_value}, max_value = {max_value}")
return 0
elif self.yscale == "linear": elif self.yscale == "linear":
return (1 - v/max_value) * 200 return (1 - v/max_value) * 200
else: else:

View File

@ -4,7 +4,6 @@ import logging
import logging.config import logging.config
import os import os
import socket import socket
import statistics
import time import time
from ltsdb_json import LTS from ltsdb_json import LTS
@ -45,13 +44,12 @@ class DiskFullPredictor:
current_used_bytes = lts.data[-1][1] current_used_bytes = lts.data[-1][1]
current_usable_bytes = usable_lts.data[-1][1] current_usable_bytes = usable_lts.data[-1][1]
tuf = 1E9 tuf = 1E9
for i in reversed(range(len(lts.data))): for d in reversed(lts.data):
m = statistics.mean(x[1] for x in lts.data[max(0, i - 2) : min(len(lts.data), i + 3)]) if d[1] < current_usable_bytes * 0.1:
if m < current_usable_bytes * 0.1:
continue # for sanity continue # for sanity
if current_used_bytes ** 2 / m > current_usable_bytes: if current_used_bytes ** 2 / d[1] > current_usable_bytes:
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", d, current_used_bytes, current_usable_bytes)
tuf = now - lts.data[i][0] tuf = now - d[0]
break break
desc = {**lts.description, desc = {**lts.description,
"measure": "time_until_disk_full", "measure": "time_until_disk_full",