Skip to content

JetBrains: Log URL and access token change events

Created by: vdavid

Fixes https://github.com/sourcegraph/sourcegraph/issues/35178

The requirements were these:

  • Log install/uninstall events when access token and/or URL changes.
    • If only the access token changes: see if we've successfully sent the "install" event, and try to send it again if not.
    • If only the URL changes, or both change: send the "uninstall" event before applying the change and the "install" event after.

Handling multiple projects is tricky. No avoid over-engineering this, I've decided to save the "has the install event been logged" flag at the application level. There is one edge case that we don't handle this way. If the user does this:

  1. Install the plugin (no access token is set, URL is sourcegraph.com by default → we log the event to sourcegraph.com)
  2. Changes the URL to ValidSourcegraphServer1 with an invalid access token in Project1
  3. Changes the URL to ValidSourcegraphServer2 with a valid access token in Project2
  4. Opens Project1 and sets the access token to a valid one, without changing the URL

Then we won't log the install event for ValidSourcegraphServer1. I think this is a caveat that we can live with.

Test plan

  • 8-min Loom
  • I used small commits with comments to make it easy to understand my train of thought.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading