wakatime / vscode-wakatime

Visual Studio Code plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vs-code
BSD 3-Clause "New" or "Revised" License
1.25k stars 139 forks source link

ability to pin cli version #229

Closed ruslandoga closed 3 years ago

ruslandoga commented 3 years ago

👋

I've been using wakatime in vscode to push heartbeats locally

[settings]
api_key                    = 6458f557-0652-4f70-a4ed-61ae5c4d2bf7
api_url                    = http://localhost:5000
debug                      = true
status_bar_coding_activity = false
status_bar_enabled         = false

[internal]
cli_version               = v1.22.1
cli_version_etag          = W/"8b65e225c90419b6285a975615f68146d1c3cf3aea0e2e81e74c30a8ce38c540"
cli_version_last_modified = Wed, 01 Sep 2021 21:48:38 GMT
backoff_at                = 2021-09-02T18:22:20+03:00
backoff_retries           = 1

but today it seems to have broke down since my local server doesn't respond with correct json:

[error] [{"caller", "/Users/runner/work/wakatime-cli/wakatime-cli/cmd/legacy/run.go:194"}, {"func", "runCmd"}, {"level", "error"}, {"message", "failed to run command: failed to send heartbeat(s) due to api error: failed to send heartbeats via api client: failed parsing results from \"http://localhost:5000/users/current/heartbeats.bulk\": failed to parse json response body: json: cannot unmarshal object into Go struct field .responses of type []json.RawMessage. body: \"{\\\"responses\\\":[{\\\"heartbeat\\\":{\\\"branch\\\":\\\"master\\\",\\\"category\\\":\\\"coding\\\",\\\"cursorpos\\\":null,\\\"dependencies\\\":null,\\\"entity\\\":\\\"/Users/q/Developer/wakatime-ingester/lib/ingester_web/controllers/heartbeat_controller.ex\\\",\\\"is_write\\\":true,\\\"language\\\":\\\"Elixir\\\",\\\"lineno\\\":null,\\\"lines\\\":34,\\\"project\\\":\\\"wakatime-ingester\\\",\\\"time\\\":1630596140.034107,\\\"type\\\":\\\"file\\\",\\\"user_agent\\\":\\\"wakatime/v1.22.1 (darwin-20.6.0-arm64) go1.16.7 vscode/1.60.0-insider vscode-wakatime/17.0.0\\\"},\\\"status\\\":201}]}\""}, {"now", "2021-09-02T18:22:20+03:00"}, {"version", "v1.22.1"}]

So I wonder if there is a way for me to pin wakatime version to the one that didn't check for response json?

ruslandoga commented 3 years ago

I've set my server to return [null, 201] for each posted heartbeat. It seems to work now.

Sorry for bothering you.

alanhamlett commented 3 years ago

BTW, have you seen https://github.com/muety/wakapi?

ruslandoga commented 3 years ago

@alanhamlett hi! Thank you, yes, that's where I learned about [null, 201]

But I just use a local db (timescale), very basic ingester, and grafana for dashboards. It seems to work most of the time.

Screenshot 2021-09-02 at 20 27 57

Also, I forgot to do it in the OP: thank you very much for wakatime :)