Skip to content

Commit

Permalink
adding Stats interface with type (elastic#69784)
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes authored Jun 24, 2020
1 parent 2e078db commit 82df228
Showing 1 changed file with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

interface Percentage {
label: string;
pct: number;
color?: string;
}
interface Bytes {
label: string;
bytes: number;
color?: string;
}
interface Numeral {
interface Stat {
type: 'number' | 'percent' | 'bytesPerSecond';
label: string;
value: number;
color?: string;
Expand All @@ -37,18 +28,18 @@ export interface FetchDataResponse {
}

export interface LogsFetchDataResponse extends FetchDataResponse {
stats: Record<string, Numeral>;
stats: Record<string, Stat>;
series: Record<string, Series>;
}

export interface MetricsFetchDataResponse extends FetchDataResponse {
stats: {
hosts: Numeral;
cpu: Percentage;
memory: Percentage;
disk: Percentage;
inboundTraffic: Bytes;
outboundTraffic: Bytes;
hosts: Stat;
cpu: Stat;
memory: Stat;
disk: Stat;
inboundTraffic: Stat;
outboundTraffic: Stat;
};
series: {
inboundTraffic: Series;
Expand All @@ -58,9 +49,9 @@ export interface MetricsFetchDataResponse extends FetchDataResponse {

export interface UptimeFetchDataResponse extends FetchDataResponse {
stats: {
monitors: Numeral;
up: Numeral;
down: Numeral;
monitors: Stat;
up: Stat;
down: Stat;
};
series: {
up: Series;
Expand All @@ -70,8 +61,8 @@ export interface UptimeFetchDataResponse extends FetchDataResponse {

export interface ApmFetchDataResponse extends FetchDataResponse {
stats: {
services: Numeral;
transactions: Numeral;
services: Stat;
transactions: Stat;
};
series: {
transactions: Series;
Expand Down

0 comments on commit 82df228

Please sign in to comment.