Browse Source

rename files

pull/5/head
rozetko 2 years ago
parent
commit
087e001534
  1. 4
      spec/elasticsearch.jest.ts
  2. 4
      spec/postgres.jest.ts
  3. 4
      spec/prometheus.jest.ts
  4. 2
      spec/utils.jest.ts
  5. 14
      src/connectors/connector_factory.ts
  6. 2
      src/connectors/elasticsearch.ts
  7. 2
      src/connectors/graphite.ts
  8. 0
      src/connectors/index.ts
  9. 2
      src/connectors/influxdb.ts
  10. 2
      src/connectors/mysql.ts
  11. 2
      src/connectors/postgres.ts
  12. 2
      src/connectors/prometheus.ts
  13. 4
      src/connectors/sql.ts
  14. 0
      src/connectors/utils.ts
  15. 4
      src/index.ts
  16. 4
      src/models/query_config.ts
  17. 2
      src/services/direct_service.ts
  18. 2
      src/services/grafana_service.ts
  19. 4
      src/tsdb-kit/index.ts
  20. 2
      src/types.ts

4
spec/elasticsearch.jest.ts

@ -1,5 +1,5 @@
import { ElasticsearchMetric } from '../src/metrics/elasticsearch_metric'; import { ElasticsearchMetric } from '../src/connectors/elasticsearch';
import { Datasource, DatasourceType } from '../src/metrics/metric'; import { Datasource, DatasourceType } from '../src/connectors';
import 'jest'; import 'jest';
import * as _ from 'lodash'; import * as _ from 'lodash';

4
spec/postgres.jest.ts

@ -1,5 +1,5 @@
import { PostgresMetric } from '../src/metrics/postgres_metric'; import { PostgresMetric } from '../src/connectors/postgres';
import { DatasourceType, DatasourceQuery } from '../src/metrics/metric'; import { DatasourceType, DatasourceQuery } from '../src/connectors';
import 'jest'; import 'jest';
import * as _ from 'lodash'; import * as _ from 'lodash';

4
spec/prometheus.jest.ts

@ -1,6 +1,6 @@
import 'jest'; import 'jest';
import { PrometheusMetric } from '../src/metrics/prometheus_metric'; import { PrometheusMetric } from '../src/connectors/prometheus';
import { DatasourceType } from '../src/metrics/metric'; import { DatasourceType } from '../src/connectors';
describe('Test Prometheus time range processing', function() { describe('Test Prometheus time range processing', function() {

2
spec/utils.jest.ts

@ -1,4 +1,4 @@
import { processSQLLimitOffset } from '../src/metrics/utils'; import { processSQLLimitOffset } from '../src/connectors/utils';
import 'jest'; import 'jest';

14
src/metrics/metrics_factory.ts → src/connectors/connector_factory.ts

@ -1,10 +1,10 @@
import { InfluxdbMetric } from './influxdb_metric'; import { InfluxdbMetric } from './influxdb';
import { GraphiteMetric } from './graphite_metric'; import { GraphiteMetric } from './graphite';
import { DatasourceConnector, DatasourceType } from './metric'; import { DatasourceConnector, DatasourceType } from '.';
import { PrometheusMetric } from './prometheus_metric'; import { PrometheusMetric } from './prometheus';
import { PostgresMetric } from './postgres_metric'; import { PostgresMetric } from './postgres';
import { ElasticsearchMetric } from './elasticsearch_metric'; import { ElasticsearchMetric } from './elasticsearch';
import { MysqlMetric } from './mysql_metric'; import { MysqlMetric } from './mysql';
import { QueryConfig } from '../models/query_config'; import { QueryConfig } from '../models/query_config';

2
src/metrics/elasticsearch_metric.ts → src/connectors/elasticsearch.ts

@ -1,4 +1,4 @@
import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from './metric'; import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from '.';
import { TsdbKitError } from '../types'; import { TsdbKitError } from '../types';
import * as _ from 'lodash'; import * as _ from 'lodash';

2
src/metrics/graphite_metric.ts → src/connectors/graphite.ts

@ -1,4 +1,4 @@
import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from './metric'; import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from '.';
import * as _ from 'lodash'; import * as _ from 'lodash';

0
src/metrics/metric.ts → src/connectors/index.ts

2
src/metrics/influxdb_metric.ts → src/connectors/influxdb.ts

@ -1,4 +1,4 @@
import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from './metric'; import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from '.';
import { processSQLLimitOffset } from './utils'; import { processSQLLimitOffset } from './utils';

2
src/metrics/mysql_metric.ts → src/connectors/mysql.ts

@ -1,4 +1,4 @@
import { SqlMetric } from './sql_metric'; import { SqlMetric } from './sql';
export class MysqlMetric extends SqlMetric { export class MysqlMetric extends SqlMetric {

2
src/metrics/postgres_metric.ts → src/connectors/postgres.ts

@ -1,4 +1,4 @@
import { SqlMetric } from './sql_metric'; import { SqlMetric } from './sql';
export class PostgresMetric extends SqlMetric { export class PostgresMetric extends SqlMetric {

2
src/metrics/prometheus_metric.ts → src/connectors/prometheus.ts

@ -1,4 +1,4 @@
import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from './metric'; import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from '.';
const QUERY_TIME_REGEX = /\&start=[^\&]*\&end=[^\&]*\&/; const QUERY_TIME_REGEX = /\&start=[^\&]*\&end=[^\&]*\&/;

4
src/metrics/sql_metric.ts → src/connectors/sql.ts

@ -1,9 +1,9 @@
import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from './metric'; import { DatasourceConnector, Datasource, DatasourceQuery, DataTable } from '.';
import { processSQLLimitOffset } from './utils'; import { processSQLLimitOffset } from './utils';
import * as _ from 'lodash'; import * as _ from 'lodash';
// for 26.09.2020 it works for all SQL datasources // as of 26.09.2020, it works for all SQL datasources
export class SqlMetric extends DatasourceConnector { export class SqlMetric extends DatasourceConnector {
private _targetName: string; //save first target name, while multi metric not implemented private _targetName: string; //save first target name, while multi metric not implemented
private url: string = 'api/tsdb/query'; private url: string = 'api/tsdb/query';

0
src/metrics/utils.ts → src/connectors/utils.ts

4
src/index.ts

@ -1,11 +1,11 @@
import { DataTable, QueryType } from './metrics/metric'; import { DataTable, QueryType } from './connectors';
import { QueryConfig } from './models/query_config'; import { QueryConfig } from './models/query_config';
import { queryDirect } from './services/direct_service'; import { queryDirect } from './services/direct_service';
import { queryGrafana } from './services/grafana_service'; import { queryGrafana } from './services/grafana_service';
import { BadRange } from './types'; import { BadRange } from './types';
export { QueryConfig } from './models/query_config'; export { QueryConfig } from './models/query_config';
export { Datasource, DatasourceType, DataTable } from './metrics/metric' export { Datasource, DatasourceType, DataTable } from './connectors'
export { DatasourceUnavailable } from './types'; export { DatasourceUnavailable } from './types';
export { GrafanaUnavailable } from './services/grafana_service'; export { GrafanaUnavailable } from './services/grafana_service';

4
src/models/query_config.ts

@ -1,5 +1,5 @@
import { Datasource, DatasourceConnector } from '../metrics/metric'; import { Datasource, DatasourceConnector } from '../connectors';
import { connectorFactory } from '../metrics/metrics_factory'; import { connectorFactory } from '../connectors/connector_factory';
export class QueryConfig { export class QueryConfig {

2
src/services/direct_service.ts

@ -1,5 +1,5 @@
import { DatasourceUnavailable } from '../types'; import { DatasourceUnavailable } from '../types';
import { Datasource, DatasourceQuery } from '../metrics/metric'; import { Datasource, DatasourceQuery } from '../connectors';
import axios from 'axios'; import axios from 'axios';
import * as _ from 'lodash'; import * as _ from 'lodash';

2
src/services/grafana_service.ts

@ -1,4 +1,4 @@
import { Datasource, DatasourceQuery } from '../metrics/metric'; import { Datasource, DatasourceQuery } from '../connectors';
import { TsdbKitError, DatasourceUnavailable } from '../types'; import { TsdbKitError, DatasourceUnavailable } from '../types';
import axios from 'axios'; import axios from 'axios';

4
src/tsdb-kit/index.ts

@ -1,12 +1,12 @@
import { queryByConfig, QueryConfig } from '..'; import { queryByConfig, QueryConfig } from '..';
import { DatasourceType, QueryType } from '../metrics/metric'; import { DatasourceType, QueryType } from '../connectors';
import * as _ from 'lodash'; import * as _ from 'lodash';
// TODO: these `const`s should be CLI arguments // TODO: these `const`s should be CLI arguments
const PROMETHEUS_URL = 'http://prometheus.metrics.corpglory.com'; const PROMETHEUS_URL = 'http://localhost:9090';
const QUERY = '100-(avg by (instance) (irate(node_cpu_seconds_total{job="nvicta-ai-node-exporter",mode="idle"}[5m])) * 100)'; const QUERY = '100-(avg by (instance) (irate(node_cpu_seconds_total{job="nvicta-ai-node-exporter",mode="idle"}[5m])) * 100)';
const FROM = 1660307430000; // ms const FROM = 1660307430000; // ms
const TO = 1660307437000; // ms const TO = 1660307437000; // ms

2
src/types.ts

@ -1,4 +1,4 @@
import { DatasourceType } from './metrics/metric'; import { DatasourceType } from './connectors';
export class TsdbKitError extends Error { export class TsdbKitError extends Error {

Loading…
Cancel
Save