0

In my rails application, I want to keep several daily metrics in order to see how this data changes over times. In other words, if I want to see how many times a user logged in on a particular date (and therefore allowing me to accumulate this data over times).

Some of this data I can figure out through queries, such as the number of posts a user made on a particular day (because the post model includes a date). However, there are many different daily metrics I want to keep track of.

I thought of creating a DataPlayers model which has data for every player and every day creating a new instance of this, but I don't think that is the best approach.

Are there best practices for this type of data collection?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Paul Smith
  • 11
  • 1
  • If I understand what you'er saying, I think your approach is best. Running a "job" at night that tallies the results for the day and records them is likely best-- then just query those results to get the changes over time. – Joe Love Jan 30 '15 at 04:18
  • And you think a new model is the best approach for storing that data? – Paul Smith Jan 30 '15 at 18:31

1 Answers1

0

You could use a gem like SqlMetrics to track events as they happen.

It stores the events in your own database so its easy to query them via sql.

Matthias
  • 363
  • 3
  • 18