← Back to team overview

graphite-dev team mailing list archive

Re: [Question #199890]: RDB (custom storage) support

 

Question #199890 on Graphite changed:
https://answers.launchpad.net/graphite/+question/199890

Description changed to:
Hi there.
Now I'm doing support for supply points values from relational database.
The database stores just timestamps of some events. Now I aggregate them to points with SQL-query like
"SELECT COUNT( * ) AS point_value, MAX( time ) AS time FROM  `Events` WHERE `time` BETWEEN  '2012-05-01 00:00:00' AND  2012-06-01 00:00:00' GROUP BY EXTRACT( DAY FROM TIME ) ORDER BY  `time`"
where `time` column is column with timestamps. I also fill zero-fields (days when was not events) with zeroes in code. So I get a list of points (sum of events per day) and some step (a day in this case) and it works. 
But! But this way is not universal. First of all I need to determine the step manually and I need to edit mysql query for each period (minutes, hours, days, years).

So I have a question: what is the best way to determine which step (secondsPerPoint) should be used and maybe graphite/whisper/carbon already have it (I can't find this code, just the code for step from whisper-file's header).
Also now I think that maybe graphite can make point's value for a hour from every-minute-point? If it is right, then another things will be very simple. You can just select from database with "GROUP BY EXTRACT( MINUTE FROM TIME )" and give it to some function witch gives you pointValues with a hour step.

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.