Skip to content

Commit 5864861

Browse files
committed
[code browser]: Measure all sessions vs errored session
1 parent 3743c60 commit 5864861

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

components/supervisor/frontend/src/ide/ide-metrics-service-client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import { serverUrl } from '../shared/urls';
88

99
export enum MetricsName {
1010
SupervisorFrontendClientTotal = "gitpod_supervisor_frontend_client_total",
11-
SupervisorFrontendErrorTotal = "gitpod_supervisor_frontend_error_total"
11+
SupervisorFrontendErrorTotal = "gitpod_supervisor_frontend_error_total",
12+
SupervisorFrontendSessionErrored = "gitpod_supervisor_frontend_sessions_errored",
13+
SupervisorFrontendSessionsTotal = "gitpod_supervisor_frontend_sessions_total"
1214
}
1315

1416
const MetricsUrl = serverUrl.asIDEMetrics().toString();

components/supervisor/frontend/src/index.ts

+15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
import { IDEMetricsServiceClient, MetricsName } from "./ide/ide-metrics-service-client";
1212
IDEMetricsServiceClient.addCounter(MetricsName.SupervisorFrontendClientTotal).catch(() => {})
1313

14+
try {
15+
if (!sessionStorage.getItem('gitpodSessionReportedLoad')) {
16+
sessionStorage.setItem('gitpodSessionReportedLoad', 'true');
17+
IDEMetricsServiceClient.addCounter(MetricsName.SupervisorFrontendSessionsTotal);
18+
}
19+
} catch {}
20+
1421
//#region supervisor frontend error capture
1522
function isElement(obj: any): obj is Element {
1623
return typeof obj.getAttribute === 'function'
@@ -30,6 +37,14 @@ window.addEventListener('error', (event) => {
3037
labels['error'] = 'LoadError';
3138
}
3239
}
40+
41+
try {
42+
if (!sessionStorage.getItem('gitpodSessionReportedError')) {
43+
sessionStorage.setItem('gitpodSessionReportedError', 'true');
44+
IDEMetricsServiceClient.addCounter(MetricsName.SupervisorFrontendSessionErrored);
45+
}
46+
} catch {}
47+
3348
IDEMetricsServiceClient.addCounter(MetricsName.SupervisorFrontendErrorTotal, labels).catch(() => {});
3449
});
3550
//#endregion

install/installer/pkg/components/ide-metrics/configmap.go

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
4646
},
4747
},
4848
},
49+
{
50+
Name: "gitpod_supervisor_frontend_sessions_errored",
51+
Help: "Total count of supervisor frontend client errored sessions",
52+
},
53+
{
54+
Name: "gitpod_supervisor_frontend_sessions_total",
55+
Help: "Total count of supervisor frontend client sessions",
56+
},
4957
{
5058
Name: "gitpod_supervisor_frontend_client_total",
5159
Help: "Total count of supervisor frontend client",

0 commit comments

Comments
 (0)