Skip to content

Commit

Permalink
[Infrastructure UI] Replace Lens table with EUI table and own api (el…
Browse files Browse the repository at this point in the history
…astic#142871)

* remove lens, add snapshot api

* add no data

* Add cpu type

* [WIP] Add eui basic table and columns

* [WIP] Add cpu cores and os

* [WIP] Mapping data to the eui basic table format

* Add Memory Total

* Refactor host mapping and add types

* Scale up memory usage percentage

* Make os optional in the model

* Text cells formatting

* Change os.type to os.name

* Move snapshot nodes mapping to a hook and test it

* Add translation

* Add fixed range and cleanup

* Fix diskLatency field name

* Remove not existing showQueryBar prop from SearchBar and set time range values

* Use last path

* Test last path change

* Type imports

* Change the way lastPath.os is set

* Type import

Co-authored-by: Jenny <[email protected]>
  • Loading branch information
neptunian and jennypavlova authored Oct 24, 2022
1 parent a05a064 commit ffc8fb9
Show file tree
Hide file tree
Showing 19 changed files with 424 additions and 590 deletions.
3 changes: 3 additions & 0 deletions x-pack/plugins/infra/common/http_api/snapshot_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const SnapshotNodePathRT = rt.intersection([
rt.partial({
ip: rt.union([rt.string, rt.null]),
}),
rt.partial({
os: rt.union([rt.string, rt.null]),
}),
]);

const SnapshotNodeMetricOptionalRT = rt.partial({
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/infra/common/inventory_models/host/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const host: InventoryModel = {
fields: {
id: 'host.name',
name: 'host.name',
os: 'host.os.name',
ip: 'host.ip',
},
metrics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
*/

import { cpu } from './snapshot/cpu';
import { cpuCores } from './snapshot/cpu_cores';
import { count } from '../../shared/metrics/snapshot/count';
import { load } from './snapshot/load';
import { logRate } from './snapshot/log_rate';
import { memory } from './snapshot/memory';
import { memoryTotal } from './snapshot/memory_total';
import { rx } from './snapshot/rx';
import { tx } from './snapshot/tx';

Expand All @@ -33,7 +35,7 @@ import { hostDockerInfo } from './tsvb/host_docker_info';

import { InventoryMetrics } from '../../types';

const exposedHostSnapshotMetrics = { cpu, load, logRate, memory, rx, tx };
const exposedHostSnapshotMetrics = { cpu, load, logRate, memory, rx, tx, cpuCores, memoryTotal };
// not sure why this is the only model with "count"
const hostSnapshotMetrics = { count, ...exposedHostSnapshotMetrics };

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { MetricsUIAggregation } from '../../../types';

export const cpuCores: MetricsUIAggregation = {
cpuCores: {
max: {
field: 'system.cpu.cores',
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { MetricsUIAggregation } from '../../../types';

export const memoryTotal: MetricsUIAggregation = {
memory_total: {
avg: {
field: 'system.memory.total',
},
},
memoryTotal: {
bucket_script: {
buckets_path: {
memoryTotal: 'memory_total',
},
script: {
source: 'params.memoryTotal / 1000000', // Convert to MB
lang: 'painless',
},
gap_policy: 'skip',
},
},
};
3 changes: 3 additions & 0 deletions x-pack/plugins/infra/common/inventory_models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ export type MetricsUIAggregation = rt.TypeOf<typeof MetricsUIAggregationRT>;
export const SnapshotMetricTypeKeys = {
count: null,
cpu: null,
cpuCores: null,
load: null,
memory: null,
memoryTotal: null,
tx: null,
rx: null,
logRate: null,
Expand Down Expand Up @@ -382,6 +384,7 @@ export interface InventoryModel {
fields: {
id: string;
name: string;
os?: string;
ip?: string;
};
crosslinkSupport: {
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/infra/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"triggersActionsUi",
"observability",
"ruleRegistry",
"unifiedSearch",
"lens"
"unifiedSearch"
],
"optionalPlugins": ["ml", "home", "embeddable", "osquery"],
"server": true,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/infra/public/apps/metrics_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const renderApp = (
return () => {
core.chrome.docTitle.reset();
ReactDOM.unmountComponentAtNode(element);
plugins.data.search.session.clear();
};
};

Expand Down
Loading

0 comments on commit ffc8fb9

Please sign in to comment.