Skip to content

Commit

Permalink
Fix telemetry events
Browse files Browse the repository at this point in the history
  • Loading branch information
agrawal-d committed Jun 4, 2024
1 parent 16131fb commit ff04119
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/companion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,16 @@ export const setupCompanionServer = () => {
});
req.on('close', function () {
try {
if (rawProblem == '') {
return;
}
const problem: Problem = JSON.parse(rawProblem);
handleNewProblem(problem);
COMPANION_LOGGING &&
console.log('Companion server closed connection.');
} catch (e) {
vscode.window.showErrorMessage(
`Error parsing problem from companion "${e}"`,
`Error parsing problem from companion "${e}. Raw problem: '${rawProblem}'"`,
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

export default {
telemetryKey: 'e57deb32-2bd3-4c02-89a5-d1f1ed0bc0d6',
telemetryKey: '560c1323-27e1-446c-98c0-f8424c435ab3',
port: 27121, // companion listener server
timeout: 10000, // for a testcase run
extensions: {
Expand Down
2 changes: 0 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ const registerCommands = (context: vscode.ExtensionContext) => {
context.subscriptions.push(disposable4);
globalThis.reporter = new TelemetryReporter(config.telemetryKey);
context.subscriptions.push(globalThis.reporter);

globalThis.reporter.sendTelemetryEvent(telmetry.EXTENSION_ACTIVATED);
};

// This method is called when the extension is activated
Expand Down
2 changes: 0 additions & 2 deletions src/telmetry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export default {
EXTENSION_ACTIVATED: 'extension-activated',
RUN_TESTCASE: 'run-testcase',
RUN_ALL_TESTCASES: 'run-all-testcases',
SUBMIT_TO_CODEFORCES: 'submit-to-codeforces',
Expand All @@ -8,5 +7,4 @@ export default {
NEW_LOCAL_PROBLEM: 'new-local-problem',
KILL_RUNNING: 'kill-running',
DELETE_ALL_TESTCASES: 'delete-all-testcases',
USE_EXTENSION: 'use-extension',
};
7 changes: 0 additions & 7 deletions src/webview/JudgeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {
import { setOnlineJudgeEnv } from '../compiler';
import telmetry from '../telmetry';

Check failure on line 15 in src/webview/JudgeView.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'telmetry' is defined but never used

let initializedOnce = false;

class JudgeViewProvider implements vscode.WebviewViewProvider {
public static readonly viewType = 'cph.judgeView';

Expand Down Expand Up @@ -109,11 +107,6 @@ class JudgeViewProvider implements vscode.WebviewViewProvider {
}

private getInitialProblem() {
if (!initializedOnce) {
globalThis.reporter.sendTelemetryEvent(telmetry.USE_EXTENSION);
}

initializedOnce = true;
const doc = vscode.window.activeTextEditor?.document;
this.extensionToJudgeViewMessage({
command: 'new-problem',
Expand Down
2 changes: 1 addition & 1 deletion src/webview/processRunAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async (problem: Problem) => {
id: testCase.id,
problem: problem,
});
await runSingleAndSave(problem, testCase.id, true);
await runSingleAndSave(problem, testCase.id, true, true);
}
console.log('Run all finished');
deleteBinary(
Expand Down
5 changes: 4 additions & 1 deletion src/webview/processRunSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ export const runSingleAndSave = async (
problem: Problem,
id: number,
skipCompile = false,
skipTelemetry = false,
) => {
globalThis.reporter.sendTelemetryEvent(telmetry.RUN_TESTCASE);
if (!skipTelemetry) {
globalThis.reporter.sendTelemetryEvent(telmetry.RUN_TESTCASE);
}
console.log('Run and save started', problem, id);
const srcPath = problem.srcPath;
const language = getLanguage(srcPath);
Expand Down

0 comments on commit ff04119

Please sign in to comment.