Skip to content

Commit ea70782

Browse files
committed
💄
1 parent 16e5f11 commit ea70782

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

src/local-ssh/proxy.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ class WebSocketSSHProxy {
148148
sendErrorReport = false;
149149
}
150150
}
151-
await Promise.allSettled([
152-
this.sendUserStatusFlow('failed'),
153-
sendErrorReport ? this.sendErrorReport(this.flow, err, 'failed to authenticate proxy with username: ' + e.username ?? '') : undefined,
154-
]);
155-
this.logService.error(err, 'failed to authenticate proxy with username: ' + e.username ?? '');
151+
152+
this.sendUserStatusFlow('failed');
153+
if (sendErrorReport) {
154+
this.sendErrorReport(this.flow, err, 'failed to authenticate proxy with username: ' + e.username ?? '');
155+
}
156+
157+
this.logService.error('failed to authenticate proxy with username: ' + e.username ?? '', err);
156158
await session.close(SshDisconnectReason.byApplication, err.toString(), err instanceof Error ? err : undefined);
157159
return null;
158160
});
@@ -165,7 +167,7 @@ class WebSocketSSHProxy {
165167
return;
166168
}
167169
this.logService.error(e, 'failed to connect to client');
168-
await this.sendErrorReport(this.flow, e, 'failed to connect to client');
170+
this.sendErrorReport(this.flow, e, 'failed to connect to client');
169171
await session.close(SshDisconnectReason.byApplication, e.toString(), e instanceof Error ? e : undefined);
170172
}
171173
}
@@ -250,14 +252,12 @@ class WebSocketSSHProxy {
250252
}, 200, 50);
251253
}
252254

253-
async sendUserStatusFlow(status: 'connected' | 'connecting' | 'failed') {
254-
this.metricsReporter.reportConnectionStatus(this.flow.gitpodHost, status, this.flow.failureCode).catch(e => {
255-
this.logService.error('Failed to report connection status', e);
256-
});
255+
sendUserStatusFlow(status: 'connected' | 'connecting' | 'failed') {
256+
this.metricsReporter.reportConnectionStatus(this.flow.gitpodHost, status, this.flow.failureCode);
257257
this.telemetryService.sendUserFlowStatus(status, this.flow);
258258
}
259259

260-
async sendErrorReport(info: UserFlowTelemetryProperties, err: Error | any, message: string) {
260+
sendErrorReport(info: UserFlowTelemetryProperties, err: Error | any, message: string) {
261261
const properties = {
262262
gitpodHost: info.gitpodHost,
263263
userId: info.userId,

src/local-ssh/telemetryService.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ export class TelemetryService implements ITelemetryService {
3434
sendEventData(eventName: string, data?: Record<string, any>) {
3535
const properties = mixin(cleanData(data ?? {}, this.cleanupPatterns, isTrustedValue), this.commonProperties);
3636

37-
this.logService.trace('Local event report', eventName, properties);
38-
3937
if (!this.segmentClient) {
4038
return;
4139
}
@@ -51,12 +49,8 @@ export class TelemetryService implements ITelemetryService {
5149
});
5250
}
5351

54-
async flush() {
55-
try {
56-
await this.segmentClient?.closeAndFlush({ timeout: 3000 });
57-
} catch (e: any) {
58-
this.logService.error('Failed to flush app analytics!', e);
59-
}
52+
flush() {
53+
// Noop, we disabled buffering
6054
}
6155

6256
sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties): void {

src/services/localSSHMetrics.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@ export class LocalSSHMetricsReporter {
1212
private readonly logService: ILogService,
1313
) { }
1414

15-
async reportConfigStatus(gitpodHost: string | undefined, status: 'success' | 'failure', failureCode?: string): Promise<void> {
15+
reportConfigStatus(gitpodHost: string, status: 'success' | 'failure', failureCode?: string) {
1616
if (status === 'success') {
1717
failureCode = 'None';
1818
}
19-
return addCounter(gitpodHost, 'vscode_desktop_local_ssh_config_total', { status, failure_code: failureCode ?? 'Unknown' }, 1, this.logService);
19+
addCounter(gitpodHost, 'vscode_desktop_local_ssh_config_total', { status, failure_code: failureCode ?? 'Unknown' }, 1, this.logService)
20+
.catch(e => this.logService.error('Error while reporting metrics', e));
2021
}
2122

22-
async reportPingExtensionStatus(gitpodHost: string | undefined, status: 'success' | 'failure'): Promise<void> {
23-
return addCounter(gitpodHost, 'vscode_desktop_ping_extension_server_total', { status }, 1, this.logService);
23+
reportPingExtensionStatus(gitpodHost: string | undefined, status: 'success' | 'failure') {
24+
addCounter(gitpodHost, 'vscode_desktop_ping_extension_server_total', { status }, 1, this.logService)
25+
.catch(e => this.logService.error('Error while reporting metrics', e));
2426
}
2527

26-
async reportConnectionStatus(gitpodHost: string | undefined, phase: 'connected' | 'connecting' | 'failed', failureCode?: string): Promise<void> {
28+
reportConnectionStatus(gitpodHost: string, phase: 'connected' | 'connecting' | 'failed', failureCode?: string) {
2729
if (phase === 'connecting' || phase === 'connected') {
2830
failureCode = 'None';
2931
}
30-
return addCounter(gitpodHost, 'vscode_desktop_local_ssh_total', { phase, failure_code: failureCode ?? 'Unknown' }, 1, this.logService);
32+
addCounter(gitpodHost, 'vscode_desktop_local_ssh_total', { phase, failure_code: failureCode ?? 'Unknown' }, 1, this.logService)
33+
.catch(e => this.logService.error('Error while reporting metrics', e));
3134
}
3235
}

0 commit comments

Comments
 (0)