diff --git a/x-pack/plugins/infra/public/__snapshots__/metrics_overview_fetchers.test.ts.snap b/x-pack/plugins/infra/public/__snapshots__/metrics_overview_fetchers.test.ts.snap new file mode 100644 index 000000000000..99ab129fc36e --- /dev/null +++ b/x-pack/plugins/infra/public/__snapshots__/metrics_overview_fetchers.test.ts.snap @@ -0,0 +1,215 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Metrics UI Observability Homepage Functions createMetricsFetchData() should just work 1`] = ` +Object { + "appLink": "/app/metrics", + "series": Object { + "inboundTraffic": Object { + "coordinates": Array [ + Object { + "x": 1593630455000, + "y": 0, + }, + Object { + "x": 1593630755000, + "y": 3.5, + }, + Object { + "x": 1593631055000, + "y": 3.5, + }, + Object { + "x": 1593631355000, + "y": 8.5, + }, + Object { + "x": 1593631655000, + "y": 3.5, + }, + Object { + "x": 1593631955000, + "y": 2.5, + }, + Object { + "x": 1593632255000, + "y": 1.5, + }, + Object { + "x": 1593632555000, + "y": 1.5, + }, + Object { + "x": 1593632855000, + "y": 3.5, + }, + Object { + "x": 1593633155000, + "y": 2.5, + }, + Object { + "x": 1593633455000, + "y": 1.5, + }, + Object { + "x": 1593633755000, + "y": 1.5, + }, + Object { + "x": 1593634055000, + "y": 2.5, + }, + Object { + "x": 1593634355000, + "y": 0, + }, + Object { + "x": 1593634655000, + "y": 10.5, + }, + Object { + "x": 1593634955000, + "y": 5.5, + }, + Object { + "x": 1593635255000, + "y": 13.5, + }, + Object { + "x": 1593635555000, + "y": 9.5, + }, + Object { + "x": 1593635855000, + "y": 7.5, + }, + Object { + "x": 1593636155000, + "y": 3, + }, + Object { + "x": 1593636455000, + "y": 3.5, + }, + ], + "label": "Inbound traffic", + }, + "outboundTraffic": Object { + "coordinates": Array [ + Object { + "x": 1593630455000, + "y": 0, + }, + Object { + "x": 1593630755000, + "y": 4, + }, + Object { + "x": 1593631055000, + "y": 4, + }, + Object { + "x": 1593631355000, + "y": 9, + }, + Object { + "x": 1593631655000, + "y": 4, + }, + Object { + "x": 1593631955000, + "y": 2.5, + }, + Object { + "x": 1593632255000, + "y": 2, + }, + Object { + "x": 1593632555000, + "y": 2, + }, + Object { + "x": 1593632855000, + "y": 4, + }, + Object { + "x": 1593633155000, + "y": 3, + }, + Object { + "x": 1593633455000, + "y": 2, + }, + Object { + "x": 1593633755000, + "y": 2, + }, + Object { + "x": 1593634055000, + "y": 2.5, + }, + Object { + "x": 1593634355000, + "y": 1, + }, + Object { + "x": 1593634655000, + "y": 11, + }, + Object { + "x": 1593634955000, + "y": 6, + }, + Object { + "x": 1593635255000, + "y": 14, + }, + Object { + "x": 1593635555000, + "y": 10, + }, + Object { + "x": 1593635855000, + "y": 8, + }, + Object { + "x": 1593636155000, + "y": 3, + }, + Object { + "x": 1593636455000, + "y": 4, + }, + ], + "label": "Outbound traffic", + }, + }, + "stats": Object { + "cpu": Object { + "label": "CPU usage", + "type": "percent", + "value": 0.0015, + }, + "hosts": Object { + "label": "Hosts", + "type": "number", + "value": 2, + }, + "inboundTraffic": Object { + "label": "Inbound traffic", + "type": "bytesPerSecond", + "value": 3.5, + }, + "memory": Object { + "label": "Memory usage", + "type": "percent", + "value": 0.0015, + }, + "outboundTraffic": Object { + "label": "Outbound traffic", + "type": "bytesPerSecond", + "value": 3, + }, + }, + "title": "Metrics", +} +`; diff --git a/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts b/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts new file mode 100644 index 000000000000..21946c7c5653 --- /dev/null +++ b/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { coreMock } from 'src/core/public/mocks'; +import { createMetricsHasData, createMetricsFetchData } from './metrics_overview_fetchers'; +import { CoreStart } from 'kibana/public'; +import { InfraClientStartDeps, InfraClientStartExports } from './types'; +import moment from 'moment'; +import { FAKE_SNAPSHOT_RESPONSE } from './test_utils'; + +function setup() { + const core = coreMock.createStart(); + const mockedGetStartServices = jest.fn(() => { + const deps = {}; + return Promise.resolve([ + core as CoreStart, + deps as InfraClientStartDeps, + void 0 as InfraClientStartExports, + ]) as Promise<[CoreStart, InfraClientStartDeps, InfraClientStartExports]>; + }); + return { core, mockedGetStartServices }; +} + +describe('Metrics UI Observability Homepage Functions', () => { + describe('createMetricsHasData()', () => { + it('should return true when true', async () => { + const { core, mockedGetStartServices } = setup(); + core.http.get.mockResolvedValue({ + status: { + indexFields: [], + logIndicesExist: false, + metricIndicesExist: true, + }, + }); + const hasData = createMetricsHasData(mockedGetStartServices); + const response = await hasData(); + expect(core.http.get).toHaveBeenCalledTimes(1); + expect(response).toBeTruthy(); + }); + it('should return false when false', async () => { + const { core, mockedGetStartServices } = setup(); + core.http.get.mockResolvedValue({ + status: { + indexFields: [], + logIndicesExist: false, + metricIndicesExist: false, + }, + }); + const hasData = createMetricsHasData(mockedGetStartServices); + const response = await hasData(); + expect(core.http.get).toHaveBeenCalledTimes(1); + expect(response).toBeFalsy(); + }); + }); + + describe('createMetricsFetchData()', () => { + it('should just work', async () => { + const { core, mockedGetStartServices } = setup(); + core.http.post.mockResolvedValue(FAKE_SNAPSHOT_RESPONSE); + const fetchData = createMetricsFetchData(mockedGetStartServices); + const endTime = moment(); + const startTime = endTime.clone().subtract(1, 'h'); + const bucketSize = '300s'; + const response = await fetchData({ + startTime: startTime.toISOString(), + endTime: endTime.toISOString(), + bucketSize, + }); + expect(core.http.post).toHaveBeenCalledTimes(1); + expect(core.http.post).toHaveBeenCalledWith('/api/metrics/snapshot', { + body: JSON.stringify({ + sourceId: 'default', + metrics: [{ type: 'cpu' }, { type: 'memory' }, { type: 'rx' }, { type: 'tx' }], + groupBy: [], + nodeType: 'host', + timerange: { + from: startTime.valueOf(), + to: endTime.valueOf(), + interval: '300s', + forceInterval: true, + ignoreLookback: true, + }, + }), + }); + expect(response).toMatchSnapshot(); + }); + }); +}); diff --git a/x-pack/plugins/infra/public/metrics_overview_fetchers.ts b/x-pack/plugins/infra/public/metrics_overview_fetchers.ts new file mode 100644 index 000000000000..d10ad5dda532 --- /dev/null +++ b/x-pack/plugins/infra/public/metrics_overview_fetchers.ts @@ -0,0 +1,161 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import moment from 'moment'; +import { sum, isFinite, isNumber } from 'lodash'; +import { i18n } from '@kbn/i18n'; +import { MetricsFetchDataResponse, FetchDataParams } from '../../observability/public'; +import { + SnapshotRequest, + SnapshotMetricInput, + SnapshotNode, + SnapshotNodeResponse, +} from '../common/http_api/snapshot_api'; +import { SnapshotMetricType } from '../common/inventory_models/types'; +import { InfraClientCoreSetup } from './types'; +import { SourceResponse } from '../common/http_api/source_api'; + +export const createMetricsHasData = ( + getStartServices: InfraClientCoreSetup['getStartServices'] +) => async () => { + const [coreServices] = await getStartServices(); + const { http } = coreServices; + const results = await http.get('/api/metrics/source/default/metrics'); + return results.status.metricIndicesExist; +}; + +export const average = (values: number[]) => (values.length ? sum(values) / values.length : 0); + +export const combineNodesBy = ( + metric: SnapshotMetricType, + nodes: SnapshotNode[], + combinator: (values: number[]) => number +) => { + const values = nodes.reduce((acc, node) => { + const snapshotMetric = node.metrics.find((m) => m.name === metric); + if (snapshotMetric?.value != null && isFinite(snapshotMetric.value)) { + acc.push(snapshotMetric.value); + } + return acc; + }, [] as number[]); + return combinator(values); +}; + +interface CombinedRow { + values: number[]; + timestamp: number; +} + +export const combineNodeTimeseriesBy = ( + metric: SnapshotMetricType, + nodes: SnapshotNode[], + combinator: (values: number[]) => number +) => { + const combinedTimeseries = nodes.reduce((acc, node) => { + const snapshotMetric = node.metrics.find((m) => m.name === metric); + if (snapshotMetric && snapshotMetric.timeseries) { + snapshotMetric.timeseries.rows.forEach((row) => { + const combinedRow = acc.find((r) => r.timestamp === row.timestamp); + if (combinedRow) { + combinedRow.values.push(isNumber(row.metric_0) ? row.metric_0 : 0); + } else { + acc.push({ + timestamp: row.timestamp, + values: [isNumber(row.metric_0) ? row.metric_0 : 0], + }); + } + }); + } + return acc; + }, [] as CombinedRow[]); + return combinedTimeseries.map((row) => ({ x: row.timestamp, y: combinator(row.values) })); +}; + +export const createMetricsFetchData = ( + getStartServices: InfraClientCoreSetup['getStartServices'] +) => async ({ + startTime, + endTime, + bucketSize, +}: FetchDataParams): Promise => { + const [coreServices] = await getStartServices(); + const { http } = coreServices; + const snapshotRequest: SnapshotRequest = { + sourceId: 'default', + metrics: ['cpu', 'memory', 'rx', 'tx'].map((type) => ({ type })) as SnapshotMetricInput[], + groupBy: [], + nodeType: 'host', + timerange: { + from: moment(startTime).valueOf(), + to: moment(endTime).valueOf(), + interval: bucketSize, + forceInterval: true, + ignoreLookback: true, + }, + }; + + const results = await http.post('/api/metrics/snapshot', { + body: JSON.stringify(snapshotRequest), + }); + + const inboundLabel = i18n.translate('xpack.infra.observabilityHomepage.metrics.rxLabel', { + defaultMessage: 'Inbound traffic', + }); + + const outboundLabel = i18n.translate('xpack.infra.observabilityHomepage.metrics.txLabel', { + defaultMessage: 'Outbound traffic', + }); + + return { + title: i18n.translate('xpack.infra.observabilityHomepage.metrics.title', { + defaultMessage: 'Metrics', + }), + appLink: '/app/metrics', + stats: { + hosts: { + type: 'number', + label: i18n.translate('xpack.infra.observabilityHomepage.metrics.hostsLabel', { + defaultMessage: 'Hosts', + }), + value: results.nodes.length, + }, + cpu: { + type: 'percent', + label: i18n.translate('xpack.infra.observabilityHomepage.metrics.cpuLabel', { + defaultMessage: 'CPU usage', + }), + value: combineNodesBy('cpu', results.nodes, average), + }, + memory: { + type: 'percent', + label: i18n.translate('xpack.infra.observabilityHomepage.metrics.memoryLabel', { + defaultMessage: 'Memory usage', + }), + value: combineNodesBy('memory', results.nodes, average), + }, + inboundTraffic: { + type: 'bytesPerSecond', + label: inboundLabel, + value: combineNodesBy('rx', results.nodes, average), + }, + outboundTraffic: { + type: 'bytesPerSecond', + label: outboundLabel, + value: combineNodesBy('tx', results.nodes, average), + }, + }, + series: { + inboundTraffic: { + label: inboundLabel, + coordinates: combineNodeTimeseriesBy('rx', results.nodes, average), + }, + outboundTraffic: { + label: outboundLabel, + coordinates: combineNodeTimeseriesBy('tx', results.nodes, average), + }, + }, + }; +}; diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts index 1b28945320bb..2dda664a7f67 100644 --- a/x-pack/plugins/infra/public/plugin.ts +++ b/x-pack/plugins/infra/public/plugin.ts @@ -19,6 +19,7 @@ import { InfraClientPluginClass, } from './types'; import { getLogsHasDataFetcher, getLogsOverviewDataFetcher } from './utils/logs_overview_fetchers'; +import { createMetricsHasData, createMetricsFetchData } from './metrics_overview_fetchers'; export class Plugin implements InfraClientPluginClass { constructor(_context: PluginInitializerContext) {} @@ -36,6 +37,12 @@ export class Plugin implements InfraClientPluginClass { hasData: getLogsHasDataFetcher(core.getStartServices), fetchData: getLogsOverviewDataFetcher(core.getStartServices), }); + + pluginsSetup.observability.dashboard.register({ + appName: 'infra_metrics', + hasData: createMetricsHasData(core.getStartServices), + fetchData: createMetricsFetchData(core.getStartServices), + }); } core.application.register({ diff --git a/x-pack/plugins/infra/public/test_utils/index.ts b/x-pack/plugins/infra/public/test_utils/index.ts new file mode 100644 index 000000000000..3de4c40f47cc --- /dev/null +++ b/x-pack/plugins/infra/public/test_utils/index.ts @@ -0,0 +1,309 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const FAKE_SNAPSHOT_RESPONSE = { + nodes: [ + { + path: [{ value: 'host-01', label: 'host-01', ip: '192.168.1.10' }], + metrics: [ + { + name: 'memory', + value: 0.002, + max: 0.00134, + avg: 0.0009833333333333335, + timeseries: { + id: 'memory', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 0.001 }, + { timestamp: 1593631055000, metric_0: 0.00099 }, + { timestamp: 1593631355000, metric_0: 0.00133 }, + { timestamp: 1593631655000, metric_0: 0.00099 }, + { timestamp: 1593631955000, metric_0: 0.001 }, + { timestamp: 1593632255000, metric_0: 0.00099 }, + { timestamp: 1593632555000, metric_0: 0.00067 }, + { timestamp: 1593632855000, metric_0: 0.001 }, + { timestamp: 1593633155000, metric_0: 0.00099 }, + { timestamp: 1593633455000, metric_0: 0.00099 }, + { timestamp: 1593633755000, metric_0: 0.00099 }, + { timestamp: 1593634055000, metric_0: 0.001 }, + { timestamp: 1593634355000, metric_0: 0.00067 }, + { timestamp: 1593634655000, metric_0: 0.00133 }, + { timestamp: 1593634955000, metric_0: 0.00101 }, + { timestamp: 1593635255000, metric_0: 0.00134 }, + { timestamp: 1593635555000, metric_0: 0.00133 }, + { timestamp: 1593635855000, metric_0: 0.00102 }, + { timestamp: 1593636155000, metric_0: 0.00101 }, + { timestamp: 1593636455000, metric_0: 0.001 }, + ], + }, + }, + { + name: 'cpu', + value: 0.002, + max: 0.00134, + avg: 0.0009833333333333335, + timeseries: { + id: 'cpu', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 0.001 }, + { timestamp: 1593631055000, metric_0: 0.00099 }, + { timestamp: 1593631355000, metric_0: 0.00133 }, + { timestamp: 1593631655000, metric_0: 0.00099 }, + { timestamp: 1593631955000, metric_0: 0.001 }, + { timestamp: 1593632255000, metric_0: 0.00099 }, + { timestamp: 1593632555000, metric_0: 0.00067 }, + { timestamp: 1593632855000, metric_0: 0.001 }, + { timestamp: 1593633155000, metric_0: 0.00099 }, + { timestamp: 1593633455000, metric_0: 0.00099 }, + { timestamp: 1593633755000, metric_0: 0.00099 }, + { timestamp: 1593634055000, metric_0: 0.001 }, + { timestamp: 1593634355000, metric_0: 0.00067 }, + { timestamp: 1593634655000, metric_0: 0.00133 }, + { timestamp: 1593634955000, metric_0: 0.00101 }, + { timestamp: 1593635255000, metric_0: 0.00134 }, + { timestamp: 1593635555000, metric_0: 0.00133 }, + { timestamp: 1593635855000, metric_0: 0.00102 }, + { timestamp: 1593636155000, metric_0: 0.00101 }, + { timestamp: 1593636455000, metric_0: 0.001 }, + ], + }, + }, + { + name: 'rx', + value: 4, + max: 13, + avg: 3.761904761904762, + timeseries: { + id: 'rx', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 4 }, + { timestamp: 1593631055000, metric_0: 4 }, + { timestamp: 1593631355000, metric_0: 9 }, + { timestamp: 1593631655000, metric_0: 4 }, + { timestamp: 1593631955000, metric_0: 3 }, + { timestamp: 1593632255000, metric_0: 2 }, + { timestamp: 1593632555000, metric_0: 2 }, + { timestamp: 1593632855000, metric_0: 4 }, + { timestamp: 1593633155000, metric_0: 3 }, + { timestamp: 1593633455000, metric_0: 2 }, + { timestamp: 1593633755000, metric_0: 2 }, + { timestamp: 1593634055000, metric_0: 3 }, + { timestamp: 1593634355000, metric_0: 0 }, + { timestamp: 1593634655000, metric_0: 11 }, + { timestamp: 1593634955000, metric_0: 6 }, + { timestamp: 1593635255000, metric_0: 14 }, + { timestamp: 1593635555000, metric_0: 10 }, + { timestamp: 1593635855000, metric_0: 8 }, + { timestamp: 1593636155000, metric_0: 4 }, + { timestamp: 1593636455000, metric_0: 4 }, + ], + }, + }, + { + name: 'tx', + value: 3, + max: 13, + avg: 3.761904761904762, + timeseries: { + id: 'tx', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 5 }, + { timestamp: 1593631055000, metric_0: 5 }, + { timestamp: 1593631355000, metric_0: 10 }, + { timestamp: 1593631655000, metric_0: 5 }, + { timestamp: 1593631955000, metric_0: 3 }, + { timestamp: 1593632255000, metric_0: 3 }, + { timestamp: 1593632555000, metric_0: 3 }, + { timestamp: 1593632855000, metric_0: 5 }, + { timestamp: 1593633155000, metric_0: 4 }, + { timestamp: 1593633455000, metric_0: 3 }, + { timestamp: 1593633755000, metric_0: 3 }, + { timestamp: 1593634055000, metric_0: 3 }, + { timestamp: 1593634355000, metric_0: 2 }, + { timestamp: 1593634655000, metric_0: 12 }, + { timestamp: 1593634955000, metric_0: 7 }, + { timestamp: 1593635255000, metric_0: 15 }, + { timestamp: 1593635555000, metric_0: 11 }, + { timestamp: 1593635855000, metric_0: 9 }, + { timestamp: 1593636155000, metric_0: 4 }, + { timestamp: 1593636455000, metric_0: 5 }, + ], + }, + }, + ], + }, + { + path: [{ value: 'host-02', label: 'host-02', ip: '192.168.1.11' }], + metrics: [ + { + name: 'memory', + value: 0.001, + max: 0.00134, + avg: 0.0009833333333333335, + timeseries: { + id: 'memory', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 0.001 }, + { timestamp: 1593631055000, metric_0: 0.00099 }, + { timestamp: 1593631355000, metric_0: 0.00133 }, + { timestamp: 1593631655000, metric_0: 0.00099 }, + { timestamp: 1593631955000, metric_0: 0.001 }, + { timestamp: 1593632255000, metric_0: 0.00099 }, + { timestamp: 1593632555000, metric_0: 0.00067 }, + { timestamp: 1593632855000, metric_0: 0.001 }, + { timestamp: 1593633155000, metric_0: 0.00099 }, + { timestamp: 1593633455000, metric_0: 0.00099 }, + { timestamp: 1593633755000, metric_0: 0.00099 }, + { timestamp: 1593634055000, metric_0: 0.001 }, + { timestamp: 1593634355000, metric_0: 0.00067 }, + { timestamp: 1593634655000, metric_0: 0.00133 }, + { timestamp: 1593634955000, metric_0: 0.00101 }, + { timestamp: 1593635255000, metric_0: 0.00134 }, + { timestamp: 1593635555000, metric_0: 0.00133 }, + { timestamp: 1593635855000, metric_0: 0.00102 }, + { timestamp: 1593636155000, metric_0: 0.00101 }, + { timestamp: 1593636455000, metric_0: 0.001 }, + ], + }, + }, + { + name: 'cpu', + value: 0.001, + max: 0.00134, + avg: 0.0009833333333333335, + timeseries: { + id: 'cpu', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 0.001 }, + { timestamp: 1593631055000, metric_0: 0.00099 }, + { timestamp: 1593631355000, metric_0: 0.00133 }, + { timestamp: 1593631655000, metric_0: 0.00099 }, + { timestamp: 1593631955000, metric_0: 0.001 }, + { timestamp: 1593632255000, metric_0: 0.00099 }, + { timestamp: 1593632555000, metric_0: 0.00067 }, + { timestamp: 1593632855000, metric_0: 0.001 }, + { timestamp: 1593633155000, metric_0: 0.00099 }, + { timestamp: 1593633455000, metric_0: 0.00099 }, + { timestamp: 1593633755000, metric_0: 0.00099 }, + { timestamp: 1593634055000, metric_0: 0.001 }, + { timestamp: 1593634355000, metric_0: 0.00067 }, + { timestamp: 1593634655000, metric_0: 0.00133 }, + { timestamp: 1593634955000, metric_0: 0.00101 }, + { timestamp: 1593635255000, metric_0: 0.00134 }, + { timestamp: 1593635555000, metric_0: 0.00133 }, + { timestamp: 1593635855000, metric_0: 0.00102 }, + { timestamp: 1593636155000, metric_0: 0.00101 }, + { timestamp: 1593636455000, metric_0: 0.001 }, + ], + }, + }, + { + name: 'rx', + value: 3, + max: 13, + avg: 3.761904761904762, + timeseries: { + id: 'rx', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 3 }, + { timestamp: 1593631055000, metric_0: 3 }, + { timestamp: 1593631355000, metric_0: 8 }, + { timestamp: 1593631655000, metric_0: 3 }, + { timestamp: 1593631955000, metric_0: 2 }, + { timestamp: 1593632255000, metric_0: 1 }, + { timestamp: 1593632555000, metric_0: 1 }, + { timestamp: 1593632855000, metric_0: 3 }, + { timestamp: 1593633155000, metric_0: 2 }, + { timestamp: 1593633455000, metric_0: 1 }, + { timestamp: 1593633755000, metric_0: 1 }, + { timestamp: 1593634055000, metric_0: 2 }, + { timestamp: 1593634355000, metric_0: 0 }, + { timestamp: 1593634655000, metric_0: 10 }, + { timestamp: 1593634955000, metric_0: 5 }, + { timestamp: 1593635255000, metric_0: 13 }, + { timestamp: 1593635555000, metric_0: 9 }, + { timestamp: 1593635855000, metric_0: 7 }, + { timestamp: 1593636155000, metric_0: 2 }, + { timestamp: 1593636455000, metric_0: 3 }, + ], + }, + }, + { + name: 'tx', + value: 3, + max: 13, + avg: 3.761904761904762, + timeseries: { + id: 'tx', + columns: [ + { name: 'timestamp', type: 'date' }, + { name: 'metric_0', type: 'number' }, + ], + rows: [ + { timestamp: 1593630455000, metric_0: 0 }, + { timestamp: 1593630755000, metric_0: 3 }, + { timestamp: 1593631055000, metric_0: 3 }, + { timestamp: 1593631355000, metric_0: 8 }, + { timestamp: 1593631655000, metric_0: 3 }, + { timestamp: 1593631955000, metric_0: 2 }, + { timestamp: 1593632255000, metric_0: 1 }, + { timestamp: 1593632555000, metric_0: 1 }, + { timestamp: 1593632855000, metric_0: 3 }, + { timestamp: 1593633155000, metric_0: 2 }, + { timestamp: 1593633455000, metric_0: 1 }, + { timestamp: 1593633755000, metric_0: 1 }, + { timestamp: 1593634055000, metric_0: 2 }, + { timestamp: 1593634355000, metric_0: 0 }, + { timestamp: 1593634655000, metric_0: 10 }, + { timestamp: 1593634955000, metric_0: 5 }, + { timestamp: 1593635255000, metric_0: 13 }, + { timestamp: 1593635555000, metric_0: 9 }, + { timestamp: 1593635855000, metric_0: 7 }, + { timestamp: 1593636155000, metric_0: 2 }, + { timestamp: 1593636455000, metric_0: 3 }, + ], + }, + }, + ], + }, + ], + interval: '300s', +}; diff --git a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts index e65d1779520c..e57dfebb3641 100644 --- a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts +++ b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts @@ -59,7 +59,6 @@ export interface MetricsFetchDataResponse extends FetchDataResponse { hosts: Stat; cpu: Stat; memory: Stat; - disk: Stat; inboundTraffic: Stat; outboundTraffic: Stat; };