Newer prometheus timestamps are actually ISO
use `datetime.fromisoformat` when the promtime pattern does not match.
This commit is contained in:
parent
994bf236af
commit
9927a67a86
11
wmn.py
11
wmn.py
|
@ -286,15 +286,8 @@ def process_prometheus_request():
|
||||||
def parse_promtime(date_string):
|
def parse_promtime(date_string):
|
||||||
match = promtime_to_isotime_pattern.match(date_string)
|
match = promtime_to_isotime_pattern.match(date_string)
|
||||||
if match is None:
|
if match is None:
|
||||||
print(
|
# weirdly enough, they switched to ISO primetime
|
||||||
"parse_promtime failed, because promtime",
|
return datetime.fromisoformat(date_string)
|
||||||
date_string,
|
|
||||||
"could not be parsed with pattern",
|
|
||||||
promtime_to_isotime_pattern,
|
|
||||||
file=sys.stderr,
|
|
||||||
flush=True,
|
|
||||||
)
|
|
||||||
abort(400)
|
|
||||||
grps = list(filter(lambda x: x is not None, match.groups()))
|
grps = list(filter(lambda x: x is not None, match.groups()))
|
||||||
if grps[-1] == "Z":
|
if grps[-1] == "Z":
|
||||||
grps[-1] = "+00:00"
|
grps[-1] = "+00:00"
|
||||||
|
|
Loading…
Reference in a new issue