From 1e0b1f158ae83f9c4998120f7f145346898684d9 Mon Sep 17 00:00:00 2001 From: "pyprobe@kav" Date: Mon, 24 Feb 2020 23:12:31 +0100 Subject: [PATCH 1/2] add decade as timeframe --- analyze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analyze.py b/analyze.py index 3086067..66384a9 100644 --- a/analyze.py +++ b/analyze.py @@ -375,7 +375,7 @@ def binarySearch(distinctSamples, samples): # Month: 3600 * 24 * 30 = 2592000 seconds # Week: 3600 * 24 * 7 = 604800 seconds # Period name, start. - for period in [('year', lastResult - 31536000), ('month', lastResult - 2592000), ('week', lastResult - 604800)]: + for period in [('decade', lastResult - 31536000 * 10), ('year', lastResult - 31536000), ('month', lastResult - 2592000), ('week', lastResult - 604800)]: # Width, height. for dimension in [(900, 300), (1200, 400)]: rrdtool.graph(args.outputDir + '/{0}_{1}x{2}_{3}'.format(period[0], dimension[0], dimension[1], args.sizeGraph), From d90c7f563e7916383f6c12063a4233fbf9d49a11 Mon Sep 17 00:00:00 2001 From: "pyprobe@kav" Date: Mon, 24 Feb 2020 23:12:41 +0100 Subject: [PATCH 2/2] fix error types --- analyze.py | 5 ++++- fnprobe/db.py | 13 +++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/analyze.py b/analyze.py index 66384a9..44928e0 100644 --- a/analyze.py +++ b/analyze.py @@ -325,7 +325,10 @@ def binarySearch(distinctSamples, samples): # not return a row, so list entries must be made manually. errors = [0] * len(errorTypes) for index, count in db.span_error_count(fromTime, toTime): - errors[index] = count + try: + errors[index] = count + except IndexError as e: + print("could not track error with index", index, "and count", count, "in list", errors, "for error types", errorTypes) # RRDTool format string to explicitly specify the order of the data sources. # The first one is implicitly the time of the sample. diff --git a/fnprobe/db.py b/fnprobe/db.py index 7e7aee4..ad56577 100644 --- a/fnprobe/db.py +++ b/fnprobe/db.py @@ -22,12 +22,13 @@ class probeTypes(Enum): # See the Error enum in src/freenet/node/probe/Error.java class errorTypes(Enum): - DISCONNECTED = 0 - OVERLOAD = 1 - TIMEOUT = 2 - UNKNOWN = 3 - UNRECOGNIZED_TYPE = 4 - CANNOT_FORWARD = 5 + DISCONNECTED=0 + OVERLOAD=1 + TIMEOUT=2 + UNKNOWN=3 + UNRECOGNIZED_TYPE=4 + CANNOT_FORWARD=5 + UNKNOWN=6 # Changes made to sequences are not transactional, no need to commit after.