aw-watcher-web icon indicating copy to clipboard operation
aw-watcher-web copied to clipboard

Watcher is inaccurate

Open johan-bjareholt opened this issue 6 years ago • 10 comments

Just played around and abstracted aw-timeline in aw-webui so you can see browser.tab.current events there and it's clear that the activity there is not correct there rather often.

johan-bjareholt avatar Jun 20 '18 16:06 johan-bjareholt

Also, it doesn't seem to detect tab-input, for example the time I was watching twitch stream was logged as afk.

lundibundi avatar Jun 24 '18 18:06 lundibundi

@lundibundi That is likely not an bug though but a feature. The criterias for browser activity to be registered are:

  • You have to provide some input (mouse or keyboard) for aw-watcher-afk to detect if you are there or not
  • You need to focus your browser window for aw-watcher-window to detect that you are actually active in your browser
  • You need to have the specific window with your specific tab open for aw-watcher-web

So in the case of watching a twitch steam you most likely either didn't move your mouse or enter anything on your keyboard so aw-watcher-afk assumed that you were AFK or you were doing something else in some other window at the same time so aw-watcher-window registered those events instead.

In this issue specifically I mostly found that the aw-watcher-web events are sometimes too short, but the actual activity should be correct.

johan-bjareholt avatar Jun 24 '18 21:06 johan-bjareholt

@johan-bjareholt But clearly if you're watching videos or twitch streams it should be logged as activity and not afk. I've checked the actual bucket of the web watcher and it seems to indeed give accurate information. So this means that the aggregator (assuming in core) should be tuned to fix this. Maybe web watcher should provide additional flag such as video: true for the aggregator to be able to differentiate afk and videos? I should probably file this as a separate issue in the aw-core?

lundibundi avatar Jun 25 '18 14:06 lundibundi

@lundibundi Yes if you've watched a Twitch stream then the web watcher will probably have logged audible: true which could be used to indicate that you were indeed not AFK despite there not being any input activity.

We've not implemented this in the data aggregation yet, but it can be done.

aw-core deals with querying/aggregation, but the actual queries that aw-core processes are specified in aw-webui. So the changes we'd need to make are in there.

ErikBjare avatar Jun 25 '18 14:06 ErikBjare

@ErikBjare Hm, do I understand it correctly that basically we need to change filterAfk handling in here https://github.com/ActivityWatch/aw-webui/blob/master/src/queries.js#L38 to not exclude audible events?

But based on aw-core/aw_transform/ there is no way to do this, so I assume we need to either add mergeEvents function to add events filtered with not_afk and add a new filter of filter_keyvals(events, "audible", [true]) to append to not_afk or implement more complex filter?

lundibundi avatar Jun 25 '18 16:06 lundibundi

@lundibundi Yes that would be correct, my preferred solution would be to add a period_union transform that takes two sets of events and returns the union of their timeperiods.

We'd then do something like this:

browser_audible = filter_keyvals(events, "audible", [true]);
non_afk_or_audible = period_union(non_afk, browser_audible);
window_browser = filter_period_intersect(window_browser, non_afk_or_audible);
events = filter_period_intersect(events, window_browser);

ErikBjare avatar Jun 26 '18 08:06 ErikBjare

@lundibundi I've implemented the needed transform period_union here: https://github.com/ActivityWatch/aw-core/pull/65

ErikBjare avatar Jun 26 '18 10:06 ErikBjare

@lundibundi I've implemented something quickly that could be refined into a working solution: https://github.com/ActivityWatch/aw-webui/pull/85

ErikBjare avatar Jun 26 '18 11:06 ErikBjare

@ErikBjare Oh, well, I did too, lol =) I should've said about that... Anyways feel free to checkout my version too)

Also I've run my tests on your version and there is one that behaves strangely, I'll comment in your PR.

lundibundi avatar Jun 26 '18 13:06 lundibundi

Hi, Really nice project and I appreciate all the efforts very much.

I have been experimenting with ActivityWatch since yesterday, and I find the desktop server watchers(default) to be accurate, in that they log a realistic sounding number of hours for my browser usage. However, when I add up the total time spent in all domains in the web-watcher, it doesn't even come close to the default watcher's total time for browser. I believe it should add up.

My current version is: 0.4.0 of the firefox web extension installed from firefox store.

LakshyAAAgrawal avatar Jan 26 '21 05:01 LakshyAAAgrawal