Closed tiefpunkt closed 10 years ago
Thats sort of an issue with the API / metric.getValues(), is the metric has no values in the given timeframe.
api.py
values = metric.getValues(timeframe)
try:
rdata['data'] = [ [value.js_time,value.value] for value in values ]
except:
rdata['data'] = [ ]
rdata['message'] = 'an error occured'
the try block fails if values is an empty list.
i wanted to add an extra function in the metric model to get the last known value to resolve this, so i can populate the value list with at least one value if there are actually values for the corresponding metric. but i did not had the time to read into adding model functions after the database is populated (you have to alter the database manually after adding new model functions or something)
will not have time to do so for at least 2 weeks, sorry
No worries, took care of it. Can you take a look whether that's ok as a fix?
yeah seems right, and does not break my test setup with zero and one value per metric
and i think i should consider another rewrite, my code looks really messy
If a metric has not been updated recently, so that there is no value withing the current timeframe shown in a graph, the dotted line suggesting the current value is missing.
The metrics API call returns an error: