Commit 8307f425 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos/collect: Use UTC time for collector.db time queries

parent d7662787
...@@ -197,11 +197,11 @@ class ConsumptionReportBase(object): ...@@ -197,11 +197,11 @@ class ConsumptionReportBase(object):
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), MAX(cpu_num_threads), SUM(memory_percent),
...@@ -243,11 +243,11 @@ class ConsumptionReportBase(object): ...@@ -243,11 +243,11 @@ class ConsumptionReportBase(object):
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), colums = """count(pid), SUM(cpu_percent), SUM(cpu_time),
SUM(cpu_num_threads), SUM(memory_percent), SUM(memory_rss), SUM(cpu_num_threads), SUM(memory_percent), SUM(memory_rss),
......
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