ActivityWatch/aw-server-rust

no previous logs are shown after switching to aw-server-rust

gabrielgrant opened this issue · 2 comments

Just switched to aw-server-rust and don't seem to have any of my previous history (total active time for the month is currently showing 6 minutes, whereas it was somewhere over 70 hours when I last checked before switching)

The docs seem to imply old data should be automatically migrated when aw-server-rust first starts

As far as I know I've never run aw-server-rust before, so I don't imagine there was a database already present. The process I used to switch over servers was

  1. un-check aw-server module from the list in the ActivityWatch system tray icon
  2. confirm that the server had stopped by trying to navigate via the dashboard and observing the network errors. Also got an error message from the chrome extension that it was no longer connected
  3. start the aw-server-rust module from the system tray icon

Interestingly, according to the logs (which took a little while to find -- since they're not in the common aw-watch logs folder, I thought the server had failed to start at first) it seems the aw-server-rust does claim to have "successfully import a legacy database":

 [2021-03-13 12:47:51][�[32mINFO�[0m][aw_datastore::datastore]: Successfully imported legacy database

But it certainly hasn't actually pulled the old data into the new sqlite DB: the new DB is only 64kb while the old DB is several megabytes

Full log output
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_server]: Using DB at path "C:\\Users\\g\\AppData\\Local\\activitywatch\\aw-server-rust\\sqlite.db"
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_server]: Using aw-webui assets at path "C:\\Users\\g\\AppData\\Local\\Programs\\ActivityWatch\\aw-server-rust\\./static/"
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_server::endpoints]: Starting aw-server-rust at 127.0.0.1:5600
[2021-03-13 12:47:51][�[32mINFO�[0m][launch]: 🔧 Configured for development.
[2021-03-13 12:47:51][�[32mINFO�[0m][launch]: 🚀 �[1;49;39mRocket has launched from�[0m �[1;4;49;39mhttp://�[0m�[1;4;49;39m127.0.0.1:5600�[0m
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_datastore::datastore]: Upgrading database to v2, adding data field to buckets
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_datastore::datastore]: Upgrading database to v3, replacing the broken data field for buckets
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_datastore::datastore]: Upgrading database to v4, adding table for key-value storage
[2021-03-13 12:47:51][�[32mINFO�[0m][aw_datastore::datastore]: Successfully imported legacy database
[2021-03-13 12:47:57][�[32mINFO�[0m][aw_datastore::datastore]: Created bucket aw-watcher-afk_LAPTOP-T6MCV0FC
[2021-03-13 12:47:57][�[32mINFO�[0m][aw_datastore::datastore]: Created bucket aw-watcher-window_LAPTOP-T6MCV0FC
[2021-03-13 12:50:02][�[32mINFO�[0m][aw_datastore::datastore]: Created bucket aw-watcher-web-chrome
[2021-03-13 12:51:10][�[31mERROR�[0m][_]: No matching routes for �[32mGET�[0m �[34m/img/icons/android-chrome-192x192.png�[0m �[33mimage/avif�[0m.
[2021-03-13 12:51:10][�[33mWARN�[0m][_]: Responding with �[31m404 Not Found�[0m catcher.
[2021-03-13 13:00:05][�[31mERROR�[0m][_]: No matching routes for �[32mGET�[0m �[34m/img/icons/android-chrome-192x192.png�[0m �[33mimage/webp�[0m.
[2021-03-13 13:00:05][�[33mWARN�[0m][_]: Responding with �[31m404 Not Found�[0m catcher.

Environment:
OS: Windows 10
ActivityWatch version (according to dashboard): v0.10.0 (rust)

Please let me know:

  1. if there's any other info that can be of use to help resolve this issue
  2. any suggestions for how to regain access to my old data (preferably without deleting the new data, since I'd like to continue using the rust server)

Thanks a lot for reporting this, we really need more people to test out aw-server-rust to be able to finalize the migration!

if there's any other info that can be of use to help resolve this issue

The logs are very valuable, by following what is and isn't logged I'm pretty sure I've narrowed it down to the fact that it can't find the old database file. I have only tried this on Linux before and I think I've found the reason why it does not work on Windows.

The legacy import code seems to look for the aw-server database inside "C:\Users<USER>\AppData\Local\activitywatch\aw-server\aw-server" while in reality it's placed inside the folder "C:\Users<USER>\AppData\Local\activitywatch*activitywatch*\aw-server\aw-server"

I hope that this should now be fixed in the following PR #224

any suggestions for how to regain access to my old data (preferably without deleting the new data, since I'd like to continue using the rust server)

This is only easy to do assuming that no buckets names conflict (which they will once you start aw-server-rust all watchers will create new buckets in aw-server-rust).

But to do it while deleting the past days of data in aw-server-rust, do the following.

  • stop all watchers
  • go into "Raw Data" tab while aw-server-rust is running and delete all buckets
  • stop aw-server-rust. start aw-server
  • go into web-ui and export all buckets in the "Raw Data" tab
  • stop aw-server, start aw-server-rust again
  • go to web-ui, press the import button and select the previously exported file
  • start all watchers again

Closing, no response if the fix worked.