From e7e004096e1a4af67f6da1df94c125ca71d9f3b4 Mon Sep 17 00:00:00 2001 From: Alexey Velikiy Date: Tue, 29 Sep 2020 19:29:24 +0200 Subject: [PATCH] Tsdb kit dep (#26) --- package.json | 2 +- src/target.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f05acf8..5065474 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,12 @@ "license": "ISC", "dependencies": {}, "devDependencies": { + "@corpglory/tsdb-kit": "^1.1.1", "@types/express": "^4.11.1", "@types/lodash": "^4.14.116", "axios": "^0.18.0", "express": "^4.16.3", "fast-csv": "^2.4.1", - "grafana-datasource-kit": "0.1.17", "moment": "^2.22.1", "nodemon": "^1.17.3", "ts-loader": "^3.5.0", diff --git a/src/target.ts b/src/target.ts index 3d173af..b824231 100644 --- a/src/target.ts +++ b/src/target.ts @@ -1,6 +1,7 @@ -import { queryByMetric, Datasource, Metric } from 'grafana-datasource-kit'; import { apiKeys } from './config'; +import { queryByMetric, Datasource, Metric } from '@corpglory/tsdb-kit'; + import * as csv from 'fast-csv'; import * as path from 'path'; import * as fs from 'fs'; @@ -15,7 +16,7 @@ export class Target { private day: number; private csvStream: any; private metric: Metric; - private createdTimestamp: number; + private createdTimestamp: number; constructor( private panelUrl: string, @@ -28,7 +29,6 @@ export class Target { ) { this.metric = new Metric(datasource, targets); } - public updateStatus(status) { let time = moment().valueOf(); @@ -87,7 +87,8 @@ export class Target { } this.csvStream.end(); } - // TODO: move csv-related stuff to service + + // TODO: move csv-related stuff to a service private initCsvStream() { this.csvStream = csv.createWriteStream({ headers: true }); let writableStream = fs.createWriteStream(this.getFilePath('csv'));