graphite-web icon indicating copy to clipboard operation
graphite-web copied to clipboard

InvalidTimeInterval thrown for date range before data present

Open mleinart opened this issue 13 years ago • 8 comments

Imported from https://bugs.launchpad.net/bugs/960031

Reported by david-henderson
Date Created Mar 20, 2012

I have a metric recorded to graphite that I want to produce a historical view for (e.g. the count in 2 months ago, last month and so far this month)

To do this, I am using the URL API with JSON formatting, using a summarise function over a fixed set of dates:

http://127.0.0.1:8804/render?from=20110202&until=20110303&target=summarize(my.metric, "29days")&format=json

This works fine if there is data in the range, but as soon as there isn't, an 500 with an InvalidTimeException is thrown:

Exception Type: InvalidTimeInterval Exception Value: Invalid time interval Exception Location: /usr/local/lib/python2.7/dist-packages/whisper.py in file_fetch, line 659

This appears to originate from this part of file_fetch.py:

oldestTime = now - header['maxRetention'] if fromTime < oldestTime: fromTime = oldestTime

if not (fromTime < untilTime): raise InvalidTimeInterval("Invalid time interval")

The from time appears to be being advanced to a point after the until time, making it invalid.

In this situation, I think a null or zero value should be returned rather than throwing an exception?

mleinart avatar Mar 13 '13 06:03 mleinart

Comment by bennett on Jun 12, 2012:

I agree that the result should be an empty or null dataset, rather than an exception. Perhaps instead of advancing the fromTime and untilTime, whisper could correctly calculate any subset of the requested interval that overlaps the retention period, and return data from that subset. If the requested interval completely misses the retention window, just return a base case of null or an empty data array.

mleinart avatar Mar 13 '13 06:03 mleinart

Hello, is there any news on this one, we are still hit by that one a fair bit :/

frlinux avatar Nov 12 '13 09:11 frlinux

+1

tjsousa avatar Feb 03 '14 23:02 tjsousa

also getting bitten by this relatively often.

sanga avatar Mar 06 '14 14:03 sanga

+1

omarmarquez avatar Mar 31 '14 21:03 omarmarquez

+1

jgpaiva avatar May 11 '15 16:05 jgpaiva

+1

punnie avatar May 11 '15 16:05 punnie

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 14 '20 03:04 stale[bot]