Skip to content

Commit

Permalink
Telemetry fix (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweininger authored Nov 1, 2024
1 parent 075c9c9 commit 5794161
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commands/cloudShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ async function cloudShellSize(consoleUri: string, terminalId: string): Promise<v
async function recordTelemetry(options: { templateUrl?: string }) {
await callWithTelemetryAndErrorHandling('vscode-dev-azure.cloudShellConnection', async (context) => {
if (options.templateUrl) {
context.telemetry.properties.templateUrl = options.templateUrl;
const repository = extractRepoFromGitHubUrl(options.templateUrl);
context.telemetry.properties.repository = repository;
}
});
}

function extractRepoFromGitHubUrl(url: string): string {
const regex = /https:\/\/github\.com\/([^\/]+\/[^\/]+)/;
const match = url.match(regex);
if (match) {
return match[1];
} else {
return '';
}
}

0 comments on commit 5794161

Please sign in to comment.