Commit 374f80be authored by Alain Takoudjou's avatar Alain Takoudjou

monitor: start-date was replaced by date in promise history

parent 11d5a350
...@@ -33,18 +33,21 @@ def buildStatistic(history_folder): ...@@ -33,18 +33,21 @@ def buildStatistic(history_folder):
last_date = None last_date = None
if stats_dict["data"]: if stats_dict["data"]:
last_date = stats_dict["data"][-1]["start-date"] if stats_dict["data"][-1].has_key("start-date"):
last_date = stats_dict["data"][-1]["date"]
else:
last_date = stats_dict["data"][-1]["date"]
with open(p) as f: with open(p) as f:
j = json.load(f) j = json.load(f)
j_last_date = j['data'][-1]["start-date"] j_last_date = j['data'][-1]["date"]
if last_date == j_last_date: if last_date == j_last_date:
# This file was already loaded, so skip # This file was already loaded, so skip
continue continue
for entry in j['data']: for entry in j['data']:
day = entry["start-date"].split(" ")[0] day = entry["date"].split("T")[0]
result.setdefault(day, {"ERROR": 0, "OK": 0}) result.setdefault(day, {"ERROR": 0, "OK": 0})
result[day][str(entry["status"])] += 1 result[day][str(entry["status"])] += 1
f.close() f.close()
...@@ -53,7 +56,7 @@ def buildStatistic(history_folder): ...@@ -53,7 +56,7 @@ def buildStatistic(history_folder):
stats_list.append( stats_list.append(
{"status": "ERROR" if stat["ERROR"] > 0 else "OK", {"status": "ERROR" if stat["ERROR"] > 0 else "OK",
"change-time": now, "change-time": now,
"start-date": j_last_date, "date": j_last_date,
"message": stat}) "message": stat})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment