remove Segment telemetry from React
This commit is contained in:
parent
3c5cd9ac88
commit
2a07966d2b
5 changed files with 11 additions and 83 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import * as vscode from "vscode";
|
||||
import { registerAllCommands } from "../commands";
|
||||
import { registerAllCodeLensProviders } from "../lang-server/codeLens";
|
||||
import { sendTelemetryEvent, TelemetryEvent } from "../telemetry";
|
||||
import IdeProtocolClient from "../continueIdeClient";
|
||||
import { getContinueServerUrl } from "../bridge";
|
||||
import { ContinueGUIWebviewViewProvider } from "../debugPanel";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import fetch from "node-fetch";
|
|||
import * as vscode from "vscode";
|
||||
import * as os from "os";
|
||||
import fkill from "fkill";
|
||||
import { sendTelemetryEvent, TelemetryEvent } from "../telemetry";
|
||||
|
||||
const WINDOWS_REMOTE_SIGNED_SCRIPTS_ERROR =
|
||||
"A Python virtual enviroment cannot be activated because running scripts is disabled for this user. In order to use Continue, please enable signed scripts to run with this command in PowerShell: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`, reload VS Code, and then try again.";
|
||||
|
|
@ -57,9 +56,6 @@ async function retryThenFail(
|
|||
vscode.window.showErrorMessage(msg);
|
||||
}
|
||||
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionSetupError, {
|
||||
error: e.message,
|
||||
});
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
@ -83,12 +79,6 @@ async function runCommand(cmd: string): Promise<[string, string | undefined]> {
|
|||
stdout = "";
|
||||
}
|
||||
|
||||
if (stderr) {
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionSetupError, {
|
||||
error: stderr,
|
||||
});
|
||||
}
|
||||
|
||||
return [stdout, stderr];
|
||||
}
|
||||
|
||||
|
|
@ -480,16 +470,11 @@ export async function startContinuePythonServer() {
|
|||
console.log("Successfully started Continue python server");
|
||||
resolve(null);
|
||||
} else if (data.includes("ERROR") || data.includes("Traceback")) {
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionSetupError, {
|
||||
error: data,
|
||||
});
|
||||
console.log("Error starting Continue python server: ", data);
|
||||
}
|
||||
});
|
||||
child.on("error", (error: any) => {
|
||||
console.log(`error: ${error.message}`);
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionSetupError, {
|
||||
error: error.message,
|
||||
});
|
||||
});
|
||||
|
||||
// Write the current version of vscode to a file called server_version.txt
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import fs = require("fs");
|
|||
import { WebsocketMessenger } from "./util/messenger";
|
||||
import { diffManager } from "./diffs";
|
||||
import path = require("path");
|
||||
import { sendTelemetryEvent, TelemetryEvent } from "./telemetry";
|
||||
import { registerAllCodeLensProviders } from "./lang-server/codeLens";
|
||||
import { registerAllCommands } from "./commands";
|
||||
import registerQuickFixProvider from "./lang-server/codeActions";
|
||||
|
|
@ -81,7 +80,6 @@ class IdeProtocolClient {
|
|||
this._newWebsocketMessenger();
|
||||
|
||||
// Register commands and providers
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionActivated);
|
||||
registerAllCodeLensProviders(context);
|
||||
registerAllCommands(context);
|
||||
registerQuickFixProvider();
|
||||
|
|
@ -171,14 +169,16 @@ class IdeProtocolClient {
|
|||
// Listen for changes to settings.json
|
||||
vscode.workspace.onDidChangeConfiguration((event) => {
|
||||
if (event.affectsConfiguration("continue")) {
|
||||
vscode.window.showInformationMessage(
|
||||
"Please reload VS Code for changes to Continue settings to take effect.",
|
||||
"Reload"
|
||||
).then((selection) => {
|
||||
if (selection === "Reload") {
|
||||
vscode.commands.executeCommand("workbench.action.reloadWindow");
|
||||
}
|
||||
});
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
"Please reload VS Code for changes to Continue settings to take effect.",
|
||||
"Reload"
|
||||
)
|
||||
.then((selection) => {
|
||||
if (selection === "Reload") {
|
||||
vscode.commands.executeCommand("workbench.action.reloadWindow");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import * as vscode from "vscode";
|
||||
import { sendTelemetryEvent, TelemetryEvent } from "./telemetry";
|
||||
import { openEditorAndRevealRange } from "./util/vscode";
|
||||
import { translate } from "./util/vscode";
|
||||
import { registerAllCodeLensProviders } from "./lang-server/codeLens";
|
||||
|
|
@ -244,7 +243,6 @@ function selectSuggestion(
|
|||
}
|
||||
|
||||
export function acceptSuggestionCommand(key: SuggestionRanges | null = null) {
|
||||
sendTelemetryEvent(TelemetryEvent.SuggestionAccepted);
|
||||
selectSuggestion("selected", key);
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +269,6 @@ export function rejectAllSuggestionsCommand() {
|
|||
export async function rejectSuggestionCommand(
|
||||
key: SuggestionRanges | null = null
|
||||
) {
|
||||
sendTelemetryEvent(TelemetryEvent.SuggestionRejected);
|
||||
selectSuggestion("old", key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
import * as Segment from "@segment/analytics-node";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
// Setup Segment
|
||||
const SEGMENT_WRITE_KEY = "57yy2uYXH2bwMuy7djm9PorfFlYqbJL1";
|
||||
const analytics = new Segment.Analytics({ writeKey: SEGMENT_WRITE_KEY });
|
||||
analytics.identify({
|
||||
userId: vscode.env.machineId,
|
||||
// traits: {
|
||||
// name: "Michael Bolton",
|
||||
// email: "mbolton@example.com",
|
||||
// createdAt: new Date("2014-06-14T02:00:19.467Z"),
|
||||
// },
|
||||
});
|
||||
|
||||
// Enum of telemetry events
|
||||
export enum TelemetryEvent {
|
||||
// Extension has been activated
|
||||
ExtensionActivated = "ExtensionActivated",
|
||||
// Suggestion has been accepted
|
||||
SuggestionAccepted = "SuggestionAccepted",
|
||||
// Suggestion has been rejected
|
||||
SuggestionRejected = "SuggestionRejected",
|
||||
// Queried universal prompt
|
||||
UniversalPromptQuery = "UniversalPromptQuery",
|
||||
// `Explain Code` button clicked
|
||||
ExplainCode = "ExplainCode",
|
||||
// `Generate Ideas` button clicked
|
||||
GenerateIdeas = "GenerateIdeas",
|
||||
// `Suggest Fix` button clicked
|
||||
SuggestFix = "SuggestFix",
|
||||
// `Create Test` button clicked
|
||||
CreateTest = "CreateTest",
|
||||
// `AutoDebug This Test` button clicked
|
||||
AutoDebugThisTest = "AutoDebugThisTest",
|
||||
// Command run to generate docstring
|
||||
GenerateDocstring = "GenerateDocstring",
|
||||
// Error setting up the extension
|
||||
ExtensionSetupError = "ExtensionSetupError",
|
||||
}
|
||||
|
||||
export function sendTelemetryEvent(
|
||||
event: TelemetryEvent,
|
||||
properties?: Record<string, any>
|
||||
) {
|
||||
if (!vscode.env.isTelemetryEnabled) return;
|
||||
|
||||
analytics.track({
|
||||
event,
|
||||
userId: vscode.env.machineId,
|
||||
properties,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue