|
|
@ -1,6 +1,7 @@ |
|
|
|
import { queryByMetric, Datasource, Metric } from 'grafana-datasource-kit'; |
|
|
|
|
|
|
|
import { apiKeys } from './config'; |
|
|
|
import { apiKeys } from './config'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { queryByMetric, Datasource, Metric } from '@corpglory/tsdb-kit'; |
|
|
|
|
|
|
|
|
|
|
|
import * as csv from 'fast-csv'; |
|
|
|
import * as csv from 'fast-csv'; |
|
|
|
import * as path from 'path'; |
|
|
|
import * as path from 'path'; |
|
|
|
import * as fs from 'fs'; |
|
|
|
import * as fs from 'fs'; |
|
|
@ -29,7 +30,6 @@ export class Target { |
|
|
|
this.metric = new Metric(datasource, targets); |
|
|
|
this.metric = new Metric(datasource, targets); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public updateStatus(status) { |
|
|
|
public updateStatus(status) { |
|
|
|
let time = moment().valueOf(); |
|
|
|
let time = moment().valueOf(); |
|
|
|
let data = { |
|
|
|
let data = { |
|
|
@ -87,7 +87,8 @@ export class Target { |
|
|
|
} |
|
|
|
} |
|
|
|
this.csvStream.end(); |
|
|
|
this.csvStream.end(); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO: move csv-related stuff to service
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: move csv-related stuff to a service
|
|
|
|
private initCsvStream() { |
|
|
|
private initCsvStream() { |
|
|
|
this.csvStream = csv.createWriteStream({ headers: true }); |
|
|
|
this.csvStream = csv.createWriteStream({ headers: true }); |
|
|
|
let writableStream = fs.createWriteStream(this.getFilePath('csv')); |
|
|
|
let writableStream = fs.createWriteStream(this.getFilePath('csv')); |
|
|
|