ActivityWatch / aw-core

Core library for ActivityWatch
Mozilla Public License 2.0
48 stars 46 forks source link

Do you want InfluxDB support? #52

Open Zurnaz opened 6 years ago

Zurnaz commented 6 years ago

I ended up adding some influxdb support to play around with custom dashboards with Grafana.

playing-with-grafana

It's a working draft and needs cleaning up. But I'm not sure if it's worth pursuing since the main thing I wanted was the annotation feature as a shortcut to tagging, but I wasn't too impressed with it in the end.

So saying that I could of gone straight to tagging since I do know VueJS, just that I find UI to be a massive timesink and tried to cheat.

Side note: I think something like web-hooks/hooks might be good idea to allow custom scripts/APIs to be triggered; like when an event is inserted.

johan-bjareholt commented 6 years ago

Sweet! In a way it's not "necessary" to have support for more than one DB, but it's definitely fun to play around with like you have here :) Having access to Grafana is very nice and as you said it's sometime nice to just be able to use a GUI for configuring different views of the data. Personally I'm very interested in this, will be much more useful than the other non-default MongoDB datastore we have right now.

Side note: I think something like web-hooks/hooks might be good idea to allow custom scripts/APIs to be triggered; like when an event is inserted.

Hooks on events could be useful yeah, but if you mean doing that for automatic tagging I don't think that's a good idea. Let's say you have collected data for 3 weeks and now want to specify a tag, if you solve it with a hook that previous data will not get any tag just because it's older than the creation of the tag. It would be easier to match the tags to the events every time you display the data, that way the tags will be consistent. Hooks could be useful if it sent a notification when I've been watching youtube for 20min though lol, would improve my productivity for sure.

KShivendu commented 1 year ago

Hey @Zurnaz, this is really cool. I created a fork inspired your your PR that adapts to the latest InfluxDB version. Also created Grafana dashboards similar to yours and what ActivityWatch UI provides. Many thanks for that!

See https://github.com/KShivendu/aw-core-influxdb

Would love to discuss/collaborate if you're still interested in improving this :)

leikoilja commented 1 month ago

@KShivendu or @Zurnaz, is any of your still using influxdb with activitywatch? i am considering that setup to just have activitywatch run on my devices as a client and ingest data to influxdb so i can do all my visualisation in a similar way how , @KShivendu did in his post

Zurnaz commented 1 month ago

Wow this is a blast from the past. No I didn't use it long term.

I did this as more of an experiment, it worked but wasn't ideal due to the way ActivityWatch structures the data vs the way InfluxDB preferred it (at the time not sure if anything changed since then). Even the graph had to be wrangled a little due to structure in influx to look correct.

Ideally I imagine you'd use a more native structure to influx but then the conversion layer will get a complexity and potentially performance hit.

PS: Sorry @KShivendu completely missed your post, but I don't think it'd be worth due to the above.