Browse Source

Tsdb kit dep (#26)

pull/1/head
Coin de Gamma 4 years ago committed by GitHub
parent
commit
e7e004096e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 7
      src/target.ts

2
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",

7
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';
@ -29,7 +30,6 @@ export class Target {
this.metric = new Metric(datasource, targets);
}
public updateStatus(status) {
let time = moment().valueOf();
let data = {
@ -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'));

Loading…
Cancel
Save