Skip to content

JetBrains: Add telemetry to the TypeScript side

Administrator requested to merge ps/jetbrains-client-telemetry into main

Created by: philipp-spiess

Part of #35178 (closed)

This PR creates a telemetry backend in TypeScript that we can use to log events inside the web view. There were a couple of considerations going into this:

  1. I started by cleaning up the GraphQL operations script. This allows us to generate proper TypeScript types for GraphQL queries that are used in the JetBrains project. I wanted to do this for the new log endpoints but also other APIs that we already use, e.g. blob content loading.
  2. We're creating a new graphQL interface that can be accessed from anywhere inside the JetBrains code and will load the correct auth token and endpoint URL
  3. Based on the implementation from VSCode, we've enabled event batching when writing log events over the wire.
  4. We have special cased IDESearchSubmited to also emit a legacy user event for every search. This is necessary to fix the issues pointed out by @erzhtor here.

Test plan

The process was to inspect the network request to ensure the right payloads are sent and also verify that the event log tab on sourcegraph.com contains the search events. I created a quick loom to better explain the testing approach:

https://www.loom.com/share/bdaa0df3a2734a908f5a4cdc736e65f3

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading