dwyl / mvp

📲 simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
84 stars 2 forks source link

Feat: Metrics! #245

Closed nelsonic closed 1 year ago

nelsonic commented 1 year ago

At present I don't have any metrics/stats for my usage of the MVP. 😞

Story

People Using the MVP

As a person using the @dwyl MVP to test the features and give feedback https://github.com/dwyl/mvp/issues/140 I want a quick way of viewing basic aggregate stats on how many items and timers I have created So that I know how much I'm using the MVP to improve my personal effectiveness.

People Building the MVP

As a person building the @dwyl MVP to solve a personal problem faced with existing task trackers or ["personal productivity" tools...] I want to know if the MVP is being used by anyone So that I know if the features are being used.

Todo

Build a basic metrics dashboard that displays:

Note: this will be an internal dashboard for now and will remain "anonymous". But in the future it will be a personal dashboard for the person using the App to see how much and when they are using it.

So we will want a visual representation of their usage similar to what GitHub has with their contribution graph:

image image

We will encourage people to have "streaks" or at least to know they are making progress toward their goals. This is "Step 1" on the Roadmap: github.com/dwyl/product-roadmap#why-are-we-building-an-app Knowing that you are making daily progress towards your goals is the secret to personal effectiveness and staying focussed long-term and not getting distracted ... See: mattcutts.com/blog/seinfeld-calendar-trick

Longer term this will be a feature in itself. But for now we just need something basic. 🙏

LuchoTurtle commented 1 year ago

I can take this issue but I just have two questions:

nelsonic commented 1 year ago

Hi @LuchoTurtle thanks for reading and replying. 🙏
really hope you're feeling much better. 🤒 -> 😊 🤞

To answer your two questions:

  1. Yes, for now, the dashboard is "internal" but it won't be hidden or restricted by any RBAC, so anyone/everyone using the MVP can see the stats and consider it a "leaderboard" of sorts. 😜
  2. On a small MVP it doesn't really matter if you re-use the live channel cause the amount of data being sent will be tiny. But I'd say that the "best practice" would be to have a stats channel that is specific to the /stats page to reduce noise on the wire. 💭

Thanks for looking into this. Will be great to have some stats/metrics! 🎉 And once the basics are done, we can do graphs too! 📈

nelsonic commented 1 year ago

This is what I had in mind:

SELECT i.person_id,
COUNT(distinct i.id) AS "num_items", 
COUNT(distinct t.id) AS "num_timers"
FROM items i
LEFT JOIN timers t ON t.item_id = i.id
GROUP BY person_id
ORDER BY person_id
nelsonic commented 1 year ago

Basic AF:

image

But it's all we need to get started. 👌

nelsonic commented 1 year ago

Compact table:

image

nelsonic commented 1 year ago

https://mvp.fly.dev/stats

image

@LuchoTurtle please investigate why. 🔍 If you get stuck ping me on Signal and we can remote-pair/debug via Zoom. 💭

SimonLab commented 1 year ago

It looks like the query is not correct:

** (Postgrex.Error) ERROR 42702 (ambiguous_column) column reference "person_id" is ambiguous

image

(you can see the logs running flyctl logs inside the mvp app folder)

LuchoTurtle commented 1 year ago

Yeah @SimonLab , I'm working on a PR to fix this. The PR will also address a few bugs introduced which don't update the stats properly. I'll be opening an issue shortly.

LuchoTurtle commented 1 year ago

Created an issue https://github.com/dwyl/mvp/issues/261 and associated PR https://github.com/dwyl/mvp/pull/262.

nelsonic commented 1 year ago

https://mvp.fly.dev/stats image

Appears to be working. 👍 Thanks again @LuchoTurtle