ihucos / counter.dev

Web Analytics made simple
https://counter.dev
GNU Affero General Public License v3.0
902 stars 39 forks source link

customizable time frame (interval) #34

Closed noraj closed 1 year ago

noraj commented 3 years ago

Would it be possible to have a customizable time frame (interval) on the dashboard?

image

instead of

image

ihucos commented 3 years ago

It would be possible. But it is non-trivial to make this in a way that is sustainable with the product being donation based. So this is a little a business development question and an ongoing thing. Essentially you would have to pay for this feature as it would need a "normal" sql database and has higher service costs. Any feedback, comments, question, thoughts very welcome :-)

ihucos commented 1 year ago

So... yeah, there is some elaborate scheme of backing up the in memory redis database to a sqlite database that is light on resources and fits the whole "free" approach.

Looking into date pickers... this one looks good: https://github.com/dangrossman/daterangepicker

noraj commented 1 year ago

If saving the data per day is to much storage (x365 per year) to be free-tier sustainable, then we could go with saving the data per week (x52 per year), if it is still too much then per month (x12 per year) and at the very least per year (x1 per year). So we could keep the temporary data (today, yesterday, this week, this month, this year) as well as permanent data (all range, + custom range on a per day/week/month/year basis).

If you want to know, my screenshot of a date picker was with bulma-calendar extension (demo).

ihucos commented 1 year ago

Thanks, yes I will need to do something like this. Now with one week of data the database is already 100 megabyte. Maybe the first weeks can be on a day to day base and then later it moves to weekly data and later maybe even to monthly as you say.

For the date picker would be nice for something that supports preselections of "Last 30 days" and so on.

ihucos commented 1 year ago

Done ;-)

That was a difficult one. Maybe there is a bug or two. Currently you can't select today or yesterday because it takes tiiimeee to save the data in the hard drive. But it's there in the redis server and available in the front end. I just need to merge it yadda yadda, you're welcome :-)

noraj commented 1 year ago

Thanks, I'll have to try that :)

Update: It's cool but I'll have to try it more when bigger time range will be selectable.