You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
771 B
40 lines
771 B
4 years ago
|
export declare type Datasource = {
|
||
|
url: string;
|
||
|
type: string;
|
||
|
params?: {
|
||
|
db: string;
|
||
|
q: string;
|
||
|
epoch: string;
|
||
|
};
|
||
|
data?: any;
|
||
|
};
|
||
|
|
||
|
export type MetricQuery = {
|
||
|
url: string;
|
||
|
method: string;
|
||
|
schema: any;
|
||
|
headers?: any;
|
||
|
}
|
||
|
|
||
|
export type MetricResults = {
|
||
|
values: any;
|
||
|
columns: any;
|
||
|
}
|
||
|
|
||
|
export type MetricId = string;
|
||
|
|
||
|
export abstract class AbstractMetric {
|
||
|
constructor(
|
||
|
public datasource: Datasource,
|
||
|
public targets: any[],
|
||
|
public id?: MetricId
|
||
|
) {};
|
||
|
abstract getQuery(from: number, to: number, limit: number, offset: number): MetricQuery;
|
||
|
/*
|
||
|
from / to - timestamp in ms
|
||
|
limit - max number of items in result
|
||
|
offset - number of items to skip from timerange start
|
||
|
*/
|
||
|
abstract getResults(res): MetricResults;
|
||
|
}
|