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

backport/jb-v7.4.x: chore(telemetry): remove legacy back-compat (#6265) #6274

Closed
wants to merge 1 commit into from

Conversation

bobheadxi
Copy link
Member

@bobheadxi bobheadxi commented Dec 6, 2024

When V2 telemetry first launched, we had to be careful to support older instances with V1 event logs, and shortly after the launch there were a series of bug fixes that necessitated several compatibility modes from 5.2.0 to 5.2.5, which was released in December 2023. After 5.2.5, we never committed to removing this back-compat as we waited for customers to slowly upgrade past 5.2.5.

Sadly, this came back to haunt us when 5.10.0 came out a few days ago, and our compatibility mode detector sorted 5.10.0 < 5.2.5, causing V2T to be exported as old event logs, which prevented them from being exported. After finding the bug and discussing it a bit, we've decided to remove this back-compat
entirely
since most Cody customers have upgraded past 5.2.5. This simplifies the code significantly.

With the backcompat gone, this basically removes the need for any of the old log-event-to-dotcom stuff, which allowed for the removal for quite a lot of unused code, which simplifies even more stuff.

Closes
https://linear.app/sourcegraph/issue/CORE-103/vscodetelemetry-remove-legacy-v1-fallback-exporter

Test plan

CI, plus a manual test:

Apply a simple patch to make telemetry export in dev without fenangling configuration (this diff is not in this PR):

diff --git a/vscode/src/services/telemetry-v2.ts b/vscode/src/services/telemetry-v2.ts
index a2857b565..6dcf1e9ad 100644
--- a/vscode/src/services/telemetry-v2.ts
+++ b/vscode/src/services/telemetry-v2.ts
@@ -43,27 +43,11 @@ export function createOrUpdateTelemetryRecorderProvider(

             const initialize = telemetryRecorderProvider === undefined

-            /**
-             * In testing, send events to the mock server.
-             */
-            if (process.env.CODY_TESTING === 'true') {
-                logDebug(debugLogLabel, 'using mock exporter')
-                updateGlobalTelemetryInstances(
-                    new MockServerTelemetryRecorderProvider({
-                        configuration,
-                        clientState,
-                    })
-                )
-            } else if (isExtensionModeDevOrTest) {
-                logDebug(debugLogLabel, 'using no-op exports')
-                updateGlobalTelemetryInstances(defaultNoOpProvider)
-            } else {
                 updateGlobalTelemetryInstances(
                     new TelemetryRecorderProvider(
                         { configuration, auth, clientState },
                     )
                 )
-            }

             /**
              * On first initialization, also record some initial events.

Run the extension:

pnpm install && pnpm build && cd vscode && pnpm run dev

In logs:

█ telemetry-v2 recordEvent: cody.auth/connected:

in the instance:

image

(cherry picked from commit 717c1d7)

When V2 telemetry first launched, we had to be careful to support older
instances with V1 event logs, and shortly after the launch there were a
series of bug fixes that necessitated several compatibility modes from
5.2.0 to 5.2.5, which was released in December 2023. After 5.2.5, we
never committed to removing this back-compat as we waited for customers
to slowly upgrade past 5.2.5.

Sadly, this came back to haunt us when 5.10.0 came out a few days ago,
and our compatibility mode detector [sorted 5.10.0 <
5.2.5](https://sourcegraph.slack.com/archives/C03JR7S7KRP/p1733430008785369?thread_ts=1733425399.918999&cid=C03JR7S7KRP),
causing V2T to be exported as old event logs, which prevented them from
being exported. After finding the bug and discussing it a bit, we've
decided to [remove this back-compat
entirely](https://sourcegraph.slack.com/archives/C03JR7S7KRP/p1733507755279819?thread_ts=1733425399.918999&cid=C03JR7S7KRP)
since most Cody customers have upgraded past 5.2.5. This simplifies the
code significantly.

With the backcompat gone, this basically removes the need for _any_ of
the old log-event-to-dotcom stuff, which allowed for the removal for
quite a lot of unused code, which simplifies even more stuff.

Closes
https://linear.app/sourcegraph/issue/CORE-103/vscodetelemetry-remove-legacy-v1-fallback-exporter

CI, plus a manual test:

Apply a simple patch to make telemetry export in dev without fenangling
configuration (this diff is not in this PR):

```diff
diff --git a/vscode/src/services/telemetry-v2.ts b/vscode/src/services/telemetry-v2.ts
index a2857b565..6dcf1e9ad 100644
--- a/vscode/src/services/telemetry-v2.ts
+++ b/vscode/src/services/telemetry-v2.ts
@@ -43,27 +43,11 @@ export function createOrUpdateTelemetryRecorderProvider(

             const initialize = telemetryRecorderProvider === undefined

-            /**
-             * In testing, send events to the mock server.
-             */
-            if (process.env.CODY_TESTING === 'true') {
-                logDebug(debugLogLabel, 'using mock exporter')
-                updateGlobalTelemetryInstances(
-                    new MockServerTelemetryRecorderProvider({
-                        configuration,
-                        clientState,
-                    })
-                )
-            } else if (isExtensionModeDevOrTest) {
-                logDebug(debugLogLabel, 'using no-op exports')
-                updateGlobalTelemetryInstances(defaultNoOpProvider)
-            } else {
                 updateGlobalTelemetryInstances(
                     new TelemetryRecorderProvider(
                         { configuration, auth, clientState },
                     )
                 )
-            }

             /**
              * On first initialization, also record some initial events.
```

Run the extension:

```
pnpm install && pnpm build && cd vscode && pnpm run dev
```

In logs:

```
█ telemetry-v2 recordEvent: cody.auth/connected:
```

in the instance:

![image](https://github.com/user-attachments/assets/5f7a40b2-662b-4447-992d-27393c9effc7)

(cherry picked from commit 717c1d7)
@bobheadxi bobheadxi requested a review from kalanchan December 6, 2024 19:49
@bobheadxi bobheadxi marked this pull request as ready for review December 6, 2024 19:49
@bobheadxi bobheadxi changed the base branch from main to jb-v7.5.x December 6, 2024 19:49
@bobheadxi bobheadxi changed the title Backport 6265 to jb v7.5.x backport: chore(telemetry): remove legacy back-compat (#6265) Dec 6, 2024
@bobheadxi bobheadxi changed the title backport: chore(telemetry): remove legacy back-compat (#6265) backport/jetbrains: chore(telemetry): remove legacy back-compat (#6265) Dec 6, 2024
@kalanchan kalanchan requested review from dominiccooney and a team December 6, 2024 20:30
@kalanchan kalanchan changed the title backport/jetbrains: chore(telemetry): remove legacy back-compat (#6265) backport/jb-v7.4.x: chore(telemetry): remove legacy back-compat (#6265) Dec 6, 2024
@kalanchan
Copy link
Contributor

@dominiccooney could you advise what to do here since we don't have a jb-v7.4.x branch in the Cody repo? We did the final release on Wednesday in the JetBrains repo already

@kalanchan
Copy link
Contributor

Dominic cut the patch off the soon to be archived jetbrains repo already in v7.4.4, you can see the cody bump here and the build

@kalanchan kalanchan closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants