Commit ebc82f01 authored by Łukasz Nowak's avatar Łukasz Nowak

monitor.collect: Use UTC time for collector.db time queries

Collector db is fixed to store UTC times, so those promises need to follow.
parent 0051bd0b
Pipeline #6424 running with stage
...@@ -103,11 +103,11 @@ class ResourceCollect: ...@@ -103,11 +103,11 @@ class ResourceCollect:
if where != "": if where != "":
where = "and %s" % where where = "and %s" % where
if not date_scope: if not date_scope:
date_scope = datetime.now().strftime('%Y-%m-%d') date_scope = datetime.utcnow().strftime('%Y-%m-%d')
if not min_time: if not min_time:
min_time = (datetime.now() - timedelta(minutes=1)).strftime('%H:%M:00') min_time = (datetime.utcnow() - timedelta(minutes=1)).strftime('%H:%M:00')
if not max_time: if not max_time:
max_time = (datetime.now() - timedelta(minutes=1)).strftime('%H:%M:59') max_time = (datetime.utcnow() - timedelta(minutes=1)).strftime('%H:%M:59')
columns = """count(pid), SUM(cpu_percent) as cpu_result, SUM(cpu_time), columns = """count(pid), SUM(cpu_percent) as cpu_result, SUM(cpu_time),
MAX(cpu_num_threads), SUM(memory_percent), SUM(memory_rss), pid, SUM(io_rw_counter), MAX(cpu_num_threads), SUM(memory_percent), SUM(memory_rss), pid, SUM(io_rw_counter),
...@@ -148,11 +148,11 @@ class ResourceCollect: ...@@ -148,11 +148,11 @@ class ResourceCollect:
if where != "": if where != "":
where = " and %s" % where where = " and %s" % where
if not date_scope: if not date_scope:
date_scope = datetime.now().strftime('%Y-%m-%d') date_scope = datetime.utcnow().strftime('%Y-%m-%d')
if not min_time: if not min_time:
min_time = (datetime.now() - timedelta(minutes=1)).strftime('%H:%M:00') min_time = (datetime.utcnow() - timedelta(minutes=1)).strftime('%H:%M:00')
if not max_time: if not max_time:
max_time = (datetime.now() - timedelta(minutes=1)).strftime('%H:%M:59') max_time = (datetime.utcnow() - timedelta(minutes=1)).strftime('%H:%M:59')
colums = """count(pid), SUM(cpu_percent), SUM(cpu_time), SUM(cpu_num_threads), SUM(memory_percent), colums = """count(pid), SUM(cpu_percent), SUM(cpu_time), SUM(cpu_num_threads), SUM(memory_percent),
SUM(memory_rss), SUM(io_rw_counter), SUM(io_cycles_counter)""" SUM(memory_rss), SUM(io_rw_counter), SUM(io_cycles_counter)"""
...@@ -272,7 +272,7 @@ def main(): ...@@ -272,7 +272,7 @@ def main():
collector = ResourceCollect(parser.collector_db) collector = ResourceCollect(parser.collector_db)
date_scope = datetime.now().strftime('%Y-%m-%d') date_scope = datetime.utcnow().strftime('%Y-%m-%d')
stat_info = os.stat(parser.output_folder) stat_info = os.stat(parser.output_folder)
partition_user = pwd.getpwuid(stat_info.st_uid)[0] partition_user = pwd.getpwuid(stat_info.st_uid)[0]
......
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