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.
|
|
|
export declare type Datasource = {
|
|
|
|
url: string;
|
|
|
|
// TODO: type: enum
|
|
|
|
type: string;
|
|
|
|
params?: {
|
|
|
|
db: string;
|
|
|
|
q: string;
|
|
|
|
epoch: string;
|
|
|
|
};
|
|
|
|
data?: any;
|
|
|
|
datasourceId?: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type MetricQuery = {
|
|
|
|
url: string;
|
|
|
|
method: string;
|
|
|
|
schema: any;
|
|
|
|
headers?: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type MetricResults = {
|
|
|
|
values: (number | null)[][];
|
|
|
|
columns: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|