Bug #13648
rest-api: api/v1/space returned a history value, not the latest value in the whisper file
0%
Description
the value returned by /api/v1/space is not the first valid value returned by the url: /graphite/render/?format=json-array&target=ceph.cluster.fsid.df.total_avail_bytes&target=ceph.cluster.fsid.df.total_used_bytes&from=-1d (graphite render view.py),
but a history value of the graphite renderview
I checked the whisper files, and find the graphite renderView's return is the same as the whisper files, but the /api/v1/space'return
is not the lastest valid point in this file.
The graphite renderView will take acount of django timezone in parseOptions, but _get_latest_graphite function which called by Space takes
UTC as default timezone value:
def _get_latest_graphite(metric):
"""
Get the latest value of a named graphite metric
"""
tzinfo = pytz.timezone("UTC")
until_time = parseATTime('now', tzinfo)
So when the django timezone (eg. America/Chicago) is later than than the UTC, the /api/v1/space will return the first valid date in the whisper file;
but when the django timezone (eg. Asia/Shanghai) is earlier than the UTC, the /api/v1/space will return a history data in the whisper file.