Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 06b2e40

Browse files
disable send crash report, refactor (#717)
1 parent 9c8c51f commit 06b2e40

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cortex-js/src/usecases/telemetry/telemetry.usecases.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export class TelemetryUsecases {
2828
source: TelemetrySource,
2929
): Promise<void> {
3030
try {
31-
const isCollectingTelemetryEnabled = process.env.CORTEX_CRASH_REPORT;
32-
if (isCollectingTelemetryEnabled !== '1') {
31+
if (this.isCrashReportEnabled() === false) {
3332
return;
3433
}
3534
const crashReport: CrashReportAttributes = this.buildCrashReport(error);
@@ -40,6 +39,9 @@ export class TelemetryUsecases {
4039
}
4140

4241
async sendCrashReport(): Promise<void> {
42+
if (!this.isCrashReportEnabled()) {
43+
return;
44+
}
4345
const crashReport = await this.telemetryRepository.getLastCrashReport();
4446
if (crashReport && !crashReport.metadata.sentAt) {
4547
const promises = [
@@ -79,4 +81,8 @@ export class TelemetryUsecases {
7981
},
8082
};
8183
}
84+
85+
private isCrashReportEnabled(): boolean {
86+
return process.env.CORTEX_CRASH_REPORT === '1';
87+
}
8288
}

0 commit comments

Comments
 (0)