Skip to content

Commit 4b93f2a

Browse files
mustard-mhjeanp413
andauthored
Add telemetry event for ssh modal (#10)
Co-authored-by: Jean Pierre <[email protected]>
1 parent a39fd10 commit 4b93f2a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/remoteConnector.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,10 @@ export default class RemoteConnector extends Disposable {
618618
return true;
619619
}
620620

621-
private async showSSHPasswordModal(password: string, gitpodHost: string) {
621+
private async showSSHPasswordModal(password: string, sshParams: SSHConnectionParams) {
622622
const maskedPassword = '•'.repeat(password.length - 3) + password.substring(password.length - 3);
623623

624-
const gitpodVersion = await getGitpodVersion(gitpodHost);
624+
const gitpodVersion = await getGitpodVersion(sshParams.gitpodHost);
625625
const sshKeysSupported = isFeatureSupported(gitpodVersion, 'SSHPublicKeys');
626626

627627
const copy: vscode.MessageItem = { title: 'Copy' };
@@ -631,12 +631,15 @@ export default class RemoteConnector extends Disposable {
631631
? `You don't have registered any SSH public key for this machine in your Gitpod account.\nAlternatively, copy and use this temporary password until workspace restart: ${maskedPassword}`
632632
: `An SSH key is required for passwordless authentication.\nAlternatively, copy and use this password: ${maskedPassword}`;
633633
const action = await vscode.window.showWarningMessage(message, { modal: true }, copy, configureSSH, showLogs);
634+
635+
this.telemetry.sendRawTelemetryEvent('vscode_desktop_ssh_gateway_modal', { action: action?.title ?? 'Canceled', ...sshParams, gitpodVersion: gitpodVersion.raw });
636+
634637
if (action === copy) {
635638
await vscode.env.clipboard.writeText(password);
636639
return;
637640
}
638641
if (action === configureSSH) {
639-
const serviceUrl = new URL(gitpodHost).toString().replace(/\/$/, '');
642+
const serviceUrl = new URL(sshParams.gitpodHost).toString().replace(/\/$/, '');
640643
const externalUrl = sshKeysSupported ? `${serviceUrl}/keys` : 'https://www.gitpod.io/docs/configure/ssh#create-an-ssh-key';
641644
await vscode.env.openExternal(vscode.Uri.parse(externalUrl));
642645
throw new Error(`SSH password modal dialog, Configure SSH`);
@@ -707,7 +710,7 @@ export default class RemoteConnector extends Disposable {
707710
sshDestination = destination;
708711

709712
if (password) {
710-
await this.showSSHPasswordModal(password, params.gitpodHost);
713+
await this.showSSHPasswordModal(password, params);
711714
}
712715

713716
this.telemetry.sendRawTelemetryEvent('vscode_desktop_ssh', { kind: 'gateway', status: 'connected', ...params, gitpodVersion: gitpodVersion.raw });

0 commit comments

Comments
 (0)