diff --git a/src/target.ts b/src/target.ts index b8628c8..e797c33 100644 --- a/src/target.ts +++ b/src/target.ts @@ -16,6 +16,7 @@ export class Target { private day: number; private csvStream: any; private metric: Metric; + private createdTimestamp: number; constructor( private panelUrl: string, @@ -81,7 +82,7 @@ export class Target { } this.csvStream.end(); } - + // TODO: move csv-related stuff to service private initCsvStream() { this.csvStream = csv.createWriteStream({ headers: true }); let writableStream = fs.createWriteStream(this.getFilePath('csv')); @@ -107,7 +108,10 @@ export class Target { } private getFilename(extension) { - return `${this.datasourceName}.${this.from}-${this.to}.${extension}`; + if(this.createdTimestamp === undefined) { + this.createdTimestamp = moment().valueOf(); + } + return `${this.createdTimestamp}.${this.datasourceName}.${extension}`; } private getFilePath(extension) {