Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/dashboard/src/service/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function testPublicAPI(service: any): void {
backoff = BASE_BACKOFF;
}
} catch (e) {
if (ConnectError.from(e).code === Code.Canceled) {
if (e instanceof ConnectError && e.code === Code.DeadlineExceeded) {
// timeout is expected, continue as usual
backoff = BASE_BACKOFF;
} else {
Expand Down
17 changes: 16 additions & 1 deletion components/public-api/typescript/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ export class MetricsReporter {
},
) {
this.metricsHost = `ide.${new URL(options.gitpodUrl).hostname}`;
if (typeof window !== "undefined") {
this.options.commonErrorDetails["userAgent"] = window.navigator.userAgent
}
}

updateCommonErrorDetails(update: { [key: string]: string | undefined }) {
Expand Down Expand Up @@ -305,6 +308,9 @@ export class MetricsReporter {
if (!enabled) {
return;
}
if (typeof window !== undefined && !window.navigator.onLine) {
return;
}

const metrics = await register.getMetricsAsJSON();
register.resetMetrics();
Expand Down Expand Up @@ -404,9 +410,14 @@ export class MetricsReporter {
return;
}
const properties = { ...data, ...this.options.commonErrorDetails };
properties["error_timestamp"] = new Date().toISOString();
properties["error_name"] = error.name;
properties["error_message"] = error.message;

if (typeof window !== undefined) {
properties["onLine"] = String(window.navigator.onLine);
}

const workspaceId = properties["workspaceId"];
const instanceId = properties["instanceId"];
const userId = properties["userId"];
Expand Down Expand Up @@ -456,7 +467,11 @@ export class MetricsReporter {

private async send(request: MetricsRequest | undefined): Promise<void> {
if (!request) {
return request;
return;
}
if (typeof window !== undefined && !window.navigator.onLine) {
this.push(request);
return;
}
this.sendQueue = this.sendQueue.then(async () => {
try {
Expand Down