← Back to team overview

graphite-dev team mailing list archive

[Question #294817]: Difference in calculating the interval from time

 

New question #294817 on Graphite:
https://answers.launchpad.net/graphite/+question/294817

Hi,
I noticed the calculation for the interval from the timestamp
for updating a data point is different from the calculation for
fetching data points.

When the whisper update a data point, the interval is t - (t % archive['secondsPerPoint'])

https://github.com/graphite-project/whisper/blob/d5dc6a07d4bfe13a14db74b595740cdc22d18531/whisper.py#L572-L593
def file_update(fh, value, timestamp):
  # ...(snip)...
  myInterval = timestamp - (timestamp % archive['secondsPerPoint'])


However when the whisper fetches datapoints, the interval is t - (t % archive['secondsPerPoint']) + archive['secondsPerPoint']

https://github.com/graphite-project/whisper/blob/d5dc6a07d4bfe13a14db74b595740cdc22d18531/whisper.py#L814-L821
def __archive_fetch(fh, archive, fromTime, untilTime):
  # ...(snip)...
  fromInterval = int(fromTime - (fromTime % archive['secondsPerPoint'])) + archive['secondsPerPoint']
  untilInterval = int(untilTime - (untilTime % archive['secondsPerPoint'])) + archive['secondsPerPoint']

Could you tell me why they are different?

Regards,
Hiroaki

-- 
You received this question notification because your team graphite-dev
is an answer contact for Graphite.