Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aw-watcher-jetbrains fails with aw-server-rust #174

Open
timwsuqld opened this issue Oct 5, 2020 · 2 comments
Open

aw-watcher-jetbrains fails with aw-server-rust #174

timwsuqld opened this issue Oct 5, 2020 · 2 comments

Comments

@timwsuqld
Copy link

https://github.com/OlivierMary/aw-watcher-jetbrains

Running activitywatch-0.9.2

There seems to be an issue with the JSON being sent, but because we don't appear to have --log-json in aw-server-rust I can't work out what the issue is.

This is the output from aw-server-rust

[2020-10-05][11:30:52][rocket::rocket][INFO] POST /api/0/buckets/aw-watcher-PhpStorm_L0365/events application/json; charset=utf-8:
[2020-10-05][11:30:52][_][INFO] Matched: POST /api/0/buckets/<bucket_id>/events (bucket_events_create)
[2020-10-05][11:30:52][_][ERROR] Couldn't parse JSON body: Error("invalid type: map, expected a sequence", line: 1, column: 0)
[2020-10-05][11:30:52][_][INFO] Outcome: Failure
[2020-10-05][11:30:52][_][WARN] Responding with 422 Unprocessable Entity catcher.
[2020-10-05][11:30:52][_][INFO] Response succeeded.

And this is debugging from aw-server showing the json (edited to protect some data)

2020-10-05 11:36:46 [DEBUG]: Received post request for event in bucket 'aw-watcher-PhpStorm_L0365' and data: {'timestamp': '2020-10-05T11:36:43.909+08:00', 'duration': 2.031, 'data': {'file': '/src/app/Repository/CardRepository.php', 'project': 'intranet', 'projectPath': '/home/timw/src/app', 'language': 'PHP', 'editor': 'PhpStorm', 'editorVersion': '2020.2.2', 'eventType': 'fr.mary.olivier.aw.watcher.listener.RAVisibleAreaListener'}}  (aw_server:168)
2020-10-05 11:36:46 [DEBUG]: 200 (127.0.0.1): POST /api/0/buckets/aw-watcher-PhpStorm_L0365/events HTTP/1.1  (flask:25)

I'm not sure if this is a bug in aw-server-rust or aw-watcher-jetbrains, but there is a compatability issue. If you can let me know what the problem is (and/or how to get log-json in aw-server-rust) then I can help aw-watch-jetbrains implement the fix if that's what's needed.

@johan-bjareholt
Copy link
Member

johan-bjareholt commented Oct 5, 2020

I think the reason is that aw-server-python accepts both a list of events as well as a signe event on the /api/0/buckets/bucketname/events endpoint while aw-server-rust only accepts a list of events so it's not really 100% API compatible.

I think it's better if a HTTP endpoint only accepts a single type for its request as that makes the API consistent and easier to document so I'd prefer that the watcher changed the way it sends events. Do you agree @ErikBjare?

@ErikBjare
Copy link
Member

ErikBjare commented Oct 5, 2020

@johan-bjareholt I agree.

I also notice that aw-watcher-jetbrains seems to not use the heartbeat API, which may make it unreliable.

Edit: Looks like it is pretty unreliable and doesn't work as is intended. See OlivierMary/aw-watcher-jetbrains#61 and OlivierMary/aw-watcher-jetbrains#30.

@ErikBjare ErikBjare changed the title Jetbrains aw-watcher-jetbrains fails with aw-server-rust aw-watcher-jetbrains fails with aw-server-rust Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants