Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export class TelemetryRepositoryImpl implements TelemetryRepository {

async getLastCrashReport(): Promise<Telemetry | null> {
try {
await this.fileManagerService.createFolderIfNotExistInDataFolder(
'telemetry',
);
const { data } = await this.fileManagerService.getLastLine(
join(await this.getTelemetryDirectory(), this.crashReportFileName),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,12 @@ export class FileManagerService {
const dataFolderPath = await this.getDataFolderPath();
return join(dataFolderPath, this.benchmarkFoldername);
}

async createFolderIfNotExistInDataFolder(folderName: string): Promise<void> {
const dataFolderPath = await this.getDataFolderPath();
const folderPath = join(dataFolderPath, folderName);
if (!existsSync(folderPath)) {
await promises.mkdir(folderPath, { recursive: true });
}
}
}
2 changes: 1 addition & 1 deletion cortex-js/src/usecases/telemetry/telemetry.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TelemetryUsecases {
): Promise<void> {
try {
const isCollectingTelemetryEnabled = process.env.CORTEX_CRASH_REPORT;
if (isCollectingTelemetryEnabled === '0') {
if (isCollectingTelemetryEnabled !== '1') {
return;
}
const crashReport: CrashReportAttributes = this.buildCrashReport(error);
Expand Down