Skip to content

Commit

Permalink
[Infra UI] Add new graphql endpoint for snapshot data (#34264)
Browse files Browse the repository at this point in the history
* Add new graphql endpoint for snapshot data

* Polishing.

* Keep type generic that is used outside snapshots

* Keep one more generic type generic

* Use camelCase for consistency.

* Refine type names

* Add return types.

* Use idiomatic javascript.

* Factor out getAllCompositeAggregationData<T>()

* Refine naming.

* More idiomatic JavaScript, more types.
  • Loading branch information
skh authored Apr 18, 2019
1 parent d860285 commit bff10d2
Show file tree
Hide file tree
Showing 27 changed files with 1,424 additions and 12 deletions.
65 changes: 64 additions & 1 deletion x-pack/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable */
/* tslint:disable */

// ====================================================
// START: Typescript template
Expand Down 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 @@ -427,6 +468,11 @@ export interface MapInfraSourceArgs {

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

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

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

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

groupBy: InfraSnapshotGroupbyInput[];

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

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 bff10d2

Please sign in to comment.