Browse Source

Change grafana-datasource-kit library to tsdb-kit (#932)

pull/1/head
Dmitry Nalobin 4 years ago committed by GitHub
parent
commit
aef1c8363d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      server/package.json
  2. 6
      server/spec/analytic_controller.jest.ts
  3. 2
      server/spec/utils_for_tests/analytic_units.ts
  4. 4
      server/src/controllers/analytics_controller.ts
  5. 2
      server/src/models/analytic_units/analytic_unit_model.ts
  6. 2
      server/src/models/analytic_units/anomaly_analytic_unit_model.ts
  7. 2
      server/src/models/analytic_units/db.ts
  8. 2
      server/src/models/analytic_units/pattern_analytic_unit_model.ts
  9. 2
      server/src/models/analytic_units/threshold_analytic_unit_model.ts
  10. 2
      server/src/models/analytic_units/types.ts
  11. 2
      server/src/services/data_puller.ts

2
server/package.json

@ -20,6 +20,7 @@
"homepage": "https://github.com/hastic/hastic-server#readme",
"dependencies": {},
"devDependencies": {
"@corpglory/tsdb-kit": "^1.1.1",
"@types/deasync": "^0.1.0",
"@types/jest": "^23.3.14",
"@types/koa": "^2.0.46",
@ -41,7 +42,6 @@
"event-stream": "3.3.4",
"file-loader": "^1.1.11",
"git-revision-webpack-plugin": "^3.0.4",
"grafana-datasource-kit": "0.1.17",
"jest": "^23.1.1",
"koa": "^2.0.46",
"koa-bodyparser": "^4.2.0",

6
server/spec/analytic_controller.jest.ts

@ -1,8 +1,8 @@
import { queryByMetric } from 'grafana-datasource-kit';
import { queryByMetric } from '@corpglory/tsdb-kit';
jest.mock('grafana-datasource-kit', () => (
jest.mock('@corpglory/tsdb-kit', () => (
{
...(jest.requireActual('grafana-datasource-kit')),
...(jest.requireActual('@corpglory/tsdb-kit')),
queryByMetric: jest.fn((metric, url, from, to, apiKey) => {
return { values:[], columns:[] }
})

2
server/spec/utils_for_tests/analytic_units.ts

@ -2,7 +2,7 @@ import * as AnalyticUnit from '../../src/models/analytic_units';
import * as AnalyticUnitCache from '../../src/models/analytic_unit_cache_model';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
import * as _ from 'lodash';

4
server/src/controllers/analytics_controller.ts

@ -12,7 +12,7 @@ import { DataPuller } from '../services/data_puller';
import { getGrafanaUrl } from '../utils/grafana';
import { cutSegmentWithSegments } from '../utils/segments';
import { queryByMetric, GrafanaUnavailable, DatasourceUnavailable } from 'grafana-datasource-kit';
import { queryByMetric, GrafanaUnavailable, DatasourceUnavailable } from '@corpglory/tsdb-kit';
import * as _ from 'lodash';
@ -20,7 +20,7 @@ const SECONDS_IN_MINUTE = 60;
type TaskResult = any;
type DetectionResult = any;
// TODO: move TableTimeSeries to grafana-datasource-kit
// TODO: move TableTimeSeries to @corpglory/tsdb-kit
// TODO: TableTimeSeries is bad name
type TableTimeSeries = { values: [number, number][], columns: string[] };
// TODO: move type definitions somewhere

2
server/src/models/analytic_units/analytic_unit_model.ts

@ -2,7 +2,7 @@ import {
AnalyticUnitId, AnalyticUnitStatus, DetectorType
} from './types';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
import * as _ from 'lodash';

2
server/src/models/analytic_units/anomaly_analytic_unit_model.ts

@ -1,7 +1,7 @@
import { AnalyticUnit } from './analytic_unit_model';
import { AnalyticUnitId, AnalyticUnitStatus, DetectorType } from './types';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
type SeasonalityPeriod = {
unit: string,

2
server/src/models/analytic_units/db.ts

@ -4,7 +4,7 @@ import { AnalyticUnitId, FindManyQuery } from './types';
import { Collection } from '../../services/data_service/collection';
import { DataService, SortingOrder } from '../../services/data_service';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
import * as _ from 'lodash';

2
server/src/models/analytic_units/pattern_analytic_unit_model.ts

@ -1,7 +1,7 @@
import { AnalyticUnit } from './analytic_unit_model';
import { AnalyticUnitId, AnalyticUnitStatus, DetectorType } from './types';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
export class PatternAnalyticUnit extends AnalyticUnit {

2
server/src/models/analytic_units/threshold_analytic_unit_model.ts

@ -1,7 +1,7 @@
import { AnalyticUnit } from './analytic_unit_model';
import { AnalyticUnitId, AnalyticUnitStatus, DetectorType } from './types';
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
export enum Condition {

2
server/src/models/analytic_units/types.ts

@ -1,4 +1,4 @@
import { Metric } from 'grafana-datasource-kit';
import { Metric } from '@corpglory/tsdb-kit';
export type AnalyticUnitId = string;

2
server/src/services/data_puller.ts

@ -7,7 +7,7 @@ import { availableReporter } from '../utils/reporter';
import { AlertService } from './alert_service';
import { getGrafanaUrl } from '../utils/grafana';
import { queryByMetric, GrafanaUnavailable, DatasourceUnavailable } from 'grafana-datasource-kit';
import { queryByMetric, GrafanaUnavailable, DatasourceUnavailable } from '@corpglory/tsdb-kit';
import * as _ from 'lodash';

Loading…
Cancel
Save