diff --git a/elastic_recheck/cmd/uncategorized_fails.py b/elastic_recheck/cmd/uncategorized_fails.py index 1f106990..f9468f7d 100755 --- a/elastic_recheck/cmd/uncategorized_fails.py +++ b/elastic_recheck/cmd/uncategorized_fails.py @@ -68,8 +68,15 @@ def all_fails(classifier): # gate. Would be nice if there was a zuul attr for this in es. if re.search("(^openstack/|devstack|grenade)", result.project): name = result.build_name - timestamp = time.strptime(result.timestamp, - "%Y-%m-%dT%H:%M:%S.%fZ") + if "+00:00" in result.timestamp: + # Newer ES adds timezone into the timestamp, and it will + # always be +00:00 + timestamp = time.strptime(result.timestamp, + "%Y-%m-%dT%H:%M:%S.%f+00:00") + else: + timestamp = time.strptime(result.timestamp, + "%Y-%m-%dT%H:%M:%S.%fZ") + log = result.log_url.split("console.html")[0] all_fails["%s.%s" % (build, name)] = { 'log': log, diff --git a/elastic_recheck/results.py b/elastic_recheck/results.py index b2ba987c..46198efd 100644 --- a/elastic_recheck/results.py +++ b/elastic_recheck/results.py @@ -109,7 +109,12 @@ class FacetSet(dict): def _histogram(self, data, facet, res=3600): """A preprocessor for data should we want to bucket it.""" if facet == "timestamp": - ts = datetime.datetime.strptime(data, "%Y-%m-%dT%H:%M:%S.%fZ") + if "+00:00" in data: + ts = datetime.datetime.strptime(data, + "%Y-%m-%dT%H:%M:%S.%f+00:00") + else: + ts = datetime.datetime.strptime(data, "%Y-%m-%dT%H:%M:%S.%fZ") + tsepoch = int(time.mktime(ts.timetuple())) # take the floor based on resolution ts -= datetime.timedelta(