Skip to content

Commit 46204dc

Browse files
authored
Add telemetry to check for potential cases of blocked activation. (#13973)
* Add telemetry to check for potential cases of blocked activation.
1 parent 0de1534 commit 46204dc

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ export class DefaultClient implements Client {
13911391
}
13921392

13931393
this.copilotCompletionProvider = CopilotCompletionContextProvider.Create();
1394+
util.setProgress(util.getProgressCopilotSuccess());
13941395
this.disposables.push(this.copilotCompletionProvider);
13951396

13961397
// Listen for messages from the language server.

Extension/src/common.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,22 @@ export function displayExtensionNotReadyPrompt(): void {
247247
// Users start with a progress of 0 and it increases as they get further along in using the tool.
248248
// This eliminates noise/problems due to re-installs, terminated installs that don't send errors,
249249
// errors followed by workarounds that lead to success, etc.
250-
const progressInstallSuccess: number = 100;
250+
const progressDebuggerStarted: number = 50;
251+
const progressDebuggerSuccess: number = 100;
251252
const progressExecutableStarted: number = 150;
253+
const progressCopilotSuccess: number = 180;
252254
const progressExecutableSuccess: number = 200;
253255
const progressParseRootSuccess: number = 300;
256+
const progressLanguageServiceDisabled: number = 400;
254257
const progressIntelliSenseNoSquiggles: number = 1000;
255258
// Might add more IntelliSense progress measurements later.
256-
// IntelliSense progress is separate from the install progress, because parse root can occur afterwards.
259+
// IntelliSense progress is separate from the activation progress, because parse root can occur afterwards.
257260

258-
const installProgressStr: string = "CPP." + packageJson.version + ".Progress";
261+
const activationProgressStr: string = "CPP." + packageJson.version + ".Progress";
259262
const intelliSenseProgressStr: string = "CPP." + packageJson.version + ".IntelliSenseProgress";
260263

261264
export function getProgress(): number {
262-
return extensionContext ? extensionContext.globalState.get<number>(installProgressStr, -1) : -1;
265+
return extensionContext ? extensionContext.globalState.get<number>(activationProgressStr, -1) : -1;
263266
}
264267

265268
export function getIntelliSenseProgress(): number {
@@ -268,15 +271,18 @@ export function getIntelliSenseProgress(): number {
268271

269272
export function setProgress(progress: number): void {
270273
if (extensionContext && getProgress() < progress) {
271-
void extensionContext.globalState.update(installProgressStr, progress);
274+
void extensionContext.globalState.update(activationProgressStr, progress);
272275
const telemetryProperties: Record<string, string> = {};
273276
let progressName: string | undefined;
274277
switch (progress) {
275-
case 0: progressName = "install started"; break;
276-
case progressInstallSuccess: progressName = "install succeeded"; break;
278+
case 0: progressName = "activation started"; break;
279+
case progressDebuggerStarted: progressName = "debugger started"; break;
280+
case progressDebuggerSuccess: progressName = "debugger succeeded"; break;
277281
case progressExecutableStarted: progressName = "executable started"; break;
282+
case progressCopilotSuccess: progressName = "copilot succeeded"; break;
278283
case progressExecutableSuccess: progressName = "executable succeeded"; break;
279284
case progressParseRootSuccess: progressName = "parse root succeeded"; break;
285+
case progressLanguageServiceDisabled: progressName = "language service disabled"; break;
280286
}
281287
if (progressName) {
282288
telemetryProperties.progress = progressName;
@@ -300,10 +306,13 @@ export function setIntelliSenseProgress(progress: number): void {
300306
}
301307
}
302308

303-
export function getProgressInstallSuccess(): number { return progressInstallSuccess; } // Download/install was successful (i.e. not blocked by component acquisition).
309+
export function getProgressDebuggerStarted(): number { return progressDebuggerStarted; } // Debugger initialization was started.
310+
export function getProgressDebuggerSuccess(): number { return progressDebuggerSuccess; } // Debugger was successfully initialized.
304311
export function getProgressExecutableStarted(): number { return progressExecutableStarted; } // The extension was activated and starting the executable was attempted.
312+
export function getProgressCopilotSuccess(): number { return progressCopilotSuccess; } // Copilot activation was successful.
305313
export function getProgressExecutableSuccess(): number { return progressExecutableSuccess; } // Starting the exe was successful (i.e. not blocked by 32-bit or glibc < 2.18 on Linux)
306314
export function getProgressParseRootSuccess(): number { return progressParseRootSuccess; } // Parse root was successful (i.e. not blocked by processing taking too long).
315+
export function getProgressLanguageServiceDisabled(): number { return progressLanguageServiceDisabled; } // The user disabled the language service.
307316
export function getProgressIntelliSenseNoSquiggles(): number { return progressIntelliSenseNoSquiggles; } // IntelliSense was successful and the user got no squiggles.
308317

309318
export function isUri(input: any): input is vscode.Uri {

Extension/src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
4242
});
4343

4444
util.setExtensionContext(context);
45-
Telemetry.activate();
4645
util.setProgress(0);
46+
Telemetry.activate();
4747

4848
// Register a protocol handler to serve localized versions of the schema for c_cpp_properties.json
4949
class SchemaProvider implements vscode.TextDocumentContentProvider {
@@ -63,7 +63,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
6363
vscode.workspace.registerTextDocumentContentProvider('cpptools-schema', instrument(new SchemaProvider()));
6464

6565
// Initialize the DebuggerExtension and register the related commands and providers.
66+
util.setProgress(util.getProgressDebuggerStarted());
6667
await DebuggerExtension.initialize(context);
68+
util.setProgress(util.getProgressDebuggerSuccess());
6769

6870
const info: PlatformInformation = await PlatformInformation.GetPlatformInformation();
6971
sendTelemetry(info);
@@ -161,6 +163,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
161163
// The check here for isIntelliSenseEngineDisabled avoids logging
162164
// the message on old Macs that we've already displayed a warning for.
163165
log(localize("intellisense.disabled", "intelliSenseEngine is disabled"));
166+
util.setProgress(util.getProgressLanguageServiceDisabled());
164167
}
165168

166169
// Send an instrumentation message upon completing activation.

0 commit comments

Comments
 (0)