Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ module.exports = function (grunt) {
],
dest: "dist/",
options: {
moduleResolution: "node",
module: "system",
target: "es5",
rootDir: "dist/",
allowSyntheticDefaultImports: true,
keepDirectoryHierarchy: false,
declaration: true,
emitDecoratorMetadata: true,
esModuleInterop: true,
experimentalDecorators: true,
sourceMap: true,
noImplicitAny: false
Expand Down
4 changes: 3 additions & 1 deletion dist/beans/request/metric_query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export declare class MetricQuery {
limit: number;
aggregators: any[];
group_by: any[];
constructor(name: string, tags: any, aggregators: any[], group_by: any[]);
start_absolute: number;
end_absolute: number;
constructor(name: string, tags: any, aggregators: any[], group_by: any[], start_absolute: number, end_absolute: number);
}
4 changes: 3 additions & 1 deletion dist/beans/request/metric_query.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/beans/request/metric_query.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion dist/beans/request/metric_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ export class MetricQuery {
public limit: number = 0;
public aggregators: any[];
public group_by: any[];
public start_absolute: number;
public end_absolute: number;

constructor(name: string, tags: any, aggregators: any[], group_by: any[]) {
constructor(name: string, tags: any, aggregators: any[], group_by: any[], start_absolute: number, end_absolute: number) {
this.name = name;
this.tags = tags;
this.aggregators = aggregators;
this.group_by = group_by;
this.start_absolute = start_absolute;
this.end_absolute = end_absolute;
}
}
8 changes: 8 additions & 0 deletions dist/beans/request/target.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { Moment } from "moment";
import { Aggregator } from "../aggregators/aggregator";
import { GroupBy } from "./group_by";
export interface TimeRange {
from: Moment | string;
to: Moment | string;
}
export declare class KairosDBTarget {
static fromObject(object: any): KairosDBTarget;
static startTime(target: KairosDBTarget): number;
static endTime(target: KairosDBTarget): number;
metricName: string;
alias: string;
tags: {
[key: string]: string[];
};
groupBy: GroupBy;
aggregators: Aggregator[];
timeRange: TimeRange;
asString(): string;
}
27 changes: 25 additions & 2 deletions dist/beans/request/target.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/beans/request/target.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions dist/beans/request/target.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import * as dateMath from "app/core/utils/datemath";
import {Moment} from "moment";
import {Aggregator} from "../aggregators/aggregator";
import * as Aggregators from "../aggregators/aggregators";
import {AggregatorParameter} from "../aggregators/parameters/aggregator_parameter";
import {GroupBy} from "./group_by";

export interface TimeRange {
from: Moment | string;
to: Moment | string;
}

export class KairosDBTarget {
public static fromObject(object: any): KairosDBTarget {
const rval = new KairosDBTarget();
Expand All @@ -12,14 +19,36 @@ export class KairosDBTarget {
rval.groupBy = GroupBy.fromObject(object.groupBy);
rval.aggregators = (object.aggregators || []).map(
(val) => Aggregators.fromObject(val));
rval.timeRange = object.timeRange;
return rval;
}

public static startTime(target: KairosDBTarget): number {
if (target.timeRange) {
const startMoment: Moment = dateMath.parse(target.timeRange.from);
if (startMoment) {
return startMoment.unix() * 1000;
}
}
return undefined;
}

public static endTime(target: KairosDBTarget): number {
if (target.timeRange) {
const endMoment: Moment = dateMath.parse(target.timeRange.to);
if (endMoment) {
return endMoment.unix() * 1000;
}
}
return undefined;
}

public metricName: string = undefined;
public alias: string = undefined;
public tags: {[key: string]: string[]} = {};
public groupBy: GroupBy = new GroupBy();
public aggregators: Aggregator[] = [];
public timeRange: TimeRange = undefined;

public asString(): string {
let str = "SELECT ";
Expand Down
9 changes: 6 additions & 3 deletions dist/core/request/query_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading