Ask A Question

Notifications

You’re not receiving notifications from this thread.

App Stats / Data (i.e. tracking long term app data trends)?

Dan Tappin asked in General

I have a multi-tenant app with various models. I want to start tracking data point for future stats and business intelligence integrations etc. Think of this like Amazon and you wanted to track each day the number of active users, categories, users, sales etc.

Is there a gem / framework out there that is used?

I thought of just writing one from scratch - as simple as a has_many type relationship where there is only a type column to match the given model and then a json or hash column to store the data points. This way I can be flexible and adjust on the fly.

I just realized as I type this I can have two kinds of data points: one for a generic model and one on the record level:

User
stats_id: 1
stats_type: User
data: { comment_count: 45, some_nested_data: { nested_data: 56, second_nested_data: 'abc' } }
date: 2021-02-09

Users
stats_id: nil
stats_type: User
data: { user_count: 45, some_other_nested_data: { nested_data: 56, second_nested_data: 'abc' } }
date: 2021-02-09

I think it's simple to just create a single Stats model and the nil id's just hang as raw data points that I can access with a custom SQL call on the model level.

I would run a rake take each morning to populate these for each model then for each record as required.

Does any one see a big issue here or have suggestions / feedback?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,972+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.