Accept epoch time offset for alarm-history
monasca-ui sends offset as epoch time in ms
to get alarm state history.
Currently this causes an error (see related story).
Change-Id: Idf870acdbc3c27d1a50627079d51d9db683431bf
Story: 1653832
Task: 3928
(cherry picked from commit e3232ba7b5
)
This commit is contained in:
parent
8a97284247
commit
e4177f7e28
|
@ -723,9 +723,14 @@ class MetricsRepository(metrics_repository.AbstractMetricsRepository):
|
|||
raise exceptions.RepositoryException(ex)
|
||||
|
||||
def _build_offset_clause(self, offset):
|
||||
|
||||
if offset:
|
||||
offset_clause = " and time > '{}'".format(offset)
|
||||
# offset may be given as a timestamp or as epoch time in ms
|
||||
if str(offset).isdigit():
|
||||
# epoch time
|
||||
offset_clause = " and time > {}ms".format(offset)
|
||||
else:
|
||||
# timestamp
|
||||
offset_clause = " and time > '{}'".format(offset)
|
||||
else:
|
||||
offset_clause = ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue