Skip to content

Commit

Permalink
Add new graphql endpoint for snapshot data
Browse files Browse the repository at this point in the history
  • Loading branch information
skh committed Apr 9, 2019
1 parent 0603f7a commit bca3954
Show file tree
Hide file tree
Showing 27 changed files with 1,487 additions and 0 deletions.
78 changes: 78 additions & 0 deletions x-pack/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface InfraSource {
logItem: InfraLogItem;
/** A hierarchy of hosts, pods, containers, services or arbitrary groups */
map?: InfraResponse | null;
/** A snapshot of nodes */
snapshot?: InfraSnapshotResponse | null;

metrics: InfraMetricData[];
}
Expand Down Expand Up @@ -223,6 +225,33 @@ export interface InfraNodeMetric {
max: number;
}

export interface InfraSnapshotResponse {
/** Nodes of type host, container or pod grouped by 0, 1 or 2 terms */
nodes: InfraSnapshotNode[];
}

export interface InfraSnapshotNode {
path: InfraSnapshotNodePath[];

metric: InfraSnapshotNodeMetric;
}

export interface InfraSnapshotNodePath {
value: string;

label: string;
}

export interface InfraSnapshotNodeMetric {
name: InfraSnapshotMetricType;

value?: number | null;

avg?: number | null;

max?: number | null;
}

export interface InfraMetricData {
id?: InfraMetric | null;

Expand Down Expand Up @@ -306,6 +335,18 @@ export interface InfraMetricInput {
/** The type of metric */
type: InfraMetricType;
}

export interface InfraSnapshotGroupbyInput {
/** The label to use in the results for the group by for the terms group by */
label?: string | null;
/** The field to group by from a terms aggregation, this is ignored by the filter type */
field?: string | null;
}

export interface InfraSnapshotMetricInput {
/** The type of metric */
type: InfraSnapshotMetricType;
}
/** The source to be created */
export interface CreateSourceInput {
/** The name of the data source */
Expand Down Expand Up @@ -374,6 +415,15 @@ export interface UpdateSourceFieldsInput {
timestamp?: string | null;
}

export interface InfraSnapshotTimerangeInput {
/** The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan. */
interval: string;
/** The end of the timerange */
to: number;
/** The beginning of the timerange */
from: number;
}

// ====================================================
// Arguments
// ====================================================
Expand Down Expand Up @@ -427,6 +477,11 @@ export interface MapInfraSourceArgs {

filterQuery?: string | null;
}
export interface SnapshotInfraSourceArgs {
timerange: InfraTimerangeInput;

filterQuery?: string | null;
}
export interface MetricsInfraSourceArgs {
nodeId: string;

Expand All @@ -444,6 +499,13 @@ export interface NodesInfraResponseArgs {

metric: InfraMetricInput;
}
export interface NodesInfraSnapshotResponseArgs {
type: InfraSnapshotType;

groupby: InfraSnapshotGroupbyInput[];

metric: InfraSnapshotMetricInput;
}
export interface CreateSourceMutationArgs {
/** The id of the source */
id: string;
Expand Down Expand Up @@ -496,6 +558,22 @@ export enum InfraMetricType {
logRate = 'logRate',
}

export enum InfraSnapshotType {
host = 'host',
pod = 'pod',
container = 'container',
}

export enum InfraSnapshotMetricType {
count = 'count',
cpu = 'cpu',
load = 'load',
memory = 'memory',
tx = 'tx',
rx = 'rx',
logRate = 'logRate',
}

export enum InfraMetric {
hostSystemOverview = 'hostSystemOverview',
hostCpuUsage = 'hostCpuUsage',
Expand Down
Loading

0 comments on commit bca3954

Please sign in to comment.