From d79a38363a0820153a283b776dd2ac557032eaa8 Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Thu, 28 Sep 2023 12:39:04 +0200 Subject: [PATCH] [Infra UI] Cleanup host-specific Node Detail Page code (#166828) closes: https://github.com/elastic/kibana/issues/166428 ## Summary This PR removes code that is no longer needed after replacing the Node Details View for Host with the Asset Details. ### TSVB The TSVB files were apparently only used to display charts in the Node Details view. Due to the Asset Details using Lens to power the charts, corresponding `host` TSVB formulas and configs are no longer needed. Therefore, `host*`, `hostK8s*`, and `hostDocker*` (the latter appears to have never been used) have been removed. Additionally, `aws*` from `required_metrics` was also removed because it was host-specific. ### FE Components The main change is in the `useMetadata` hook. I have changed the hook signature, making `requiredMetrics` optional. This parameter is used to process additional filtering and is only used in asset types that the old Node Details page supports. Not passing it is not expected to break other places that depend on this hook. ### Server Removing TSVB files has a direct impact on the `api/metrics/node_details` endpoint. This endpoint is only used to provide data to the Node Details page. It returns a 400 error if an invalid metric is passed - which will be the case for hosts **Example Request:** ```json POST kbn:api/metrics/node_details { "metrics": [ "hostK8sCpuCap", "hostSystemOverview" ], "nodeId": "gke-release-oblt-release-oblt-pool-c4163099-bcaj", "nodeType": "host", "timerange": { "from": 1695210522045, "to": 1695214122045, "interval": ">=1m" }, "cloudId": "6106013995483209805", "sourceId": "default" } ``` **Response:** ```json { "statusCode": 400, "error": "Bad Request", "message": "Failed to validate: \n in metrics/0: \"hostK8sCpuCap\" does not match expected type \"podOverview\" | \"podCpuUsage\" | \"podMemoryUsage\" | \"podLogUsage\" | \"podNetworkTraffic\" | \"containerOverview\" | \"containerCpuKernel\" | \"containerCpuUsage\" | \"containerDiskIOOps\" | \"containerDiskIOBytes\" | \"containerMemory\" | \"containerNetworkTraffic\" | \"containerK8sOverview\" | \"containerK8sCpuUsage\" | \"containerK8sMemoryUsage\" | \"nginxHits\" | \"nginxRequestRate\" | \"nginxActiveConnections\" | \"nginxRequestsPerConnection\" | \"awsEC2CpuUtilization\" | \"awsEC2NetworkTraffic\" | \"awsEC2DiskIOBytes\" | \"awsS3TotalRequests\" | \"awsS3NumberOfObjects\" | \"awsS3BucketSize\" | \"awsS3DownloadBytes\" | \"awsS3UploadBytes\" | \"awsRDSCpuTotal\" | \"awsRDSConnections\" | \"awsRDSQueriesExecuted\" | \"awsRDSActiveTransactions\" | \"awsRDSLatency\" | \"awsSQSMessagesVisible\" | \"awsSQSMessagesDelayed\" | \"awsSQSMessagesSent\" | \"awsSQSMessagesEmpty\" | \"awsSQSOldestMessage\" | \"custom\"\n in metrics/1: \"hostSystemOverview\" does not match expected type \"podOverview\" | \"podCpuUsage\" | \"podMemoryUsage\" | \"podLogUsage\" | \"podNetworkTraffic\" | \"containerOverview\" | \"containerCpuKernel\" | \"containerCpuUsage\" | \"containerDiskIOOps\" | \"containerDiskIOBytes\" | \"containerMemory\" | \"containerNetworkTraffic\" | \"containerK8sOverview\" | \"containerK8sCpuUsage\" | \"containerK8sMemoryUsage\" | \"nginxHits\" | \"nginxRequestRate\" | \"nginxActiveConnections\" | \"nginxRequestsPerConnection\" | \"awsEC2CpuUtilization\" | \"awsEC2NetworkTraffic\" | \"awsEC2DiskIOBytes\" | \"awsS3TotalRequests\" | \"awsS3NumberOfObjects\" | \"awsS3BucketSize\" | \"awsS3DownloadBytes\" | \"awsS3UploadBytes\" | \"awsRDSCpuTotal\" | \"awsRDSConnections\" | \"awsRDSQueriesExecuted\" | \"awsRDSActiveTransactions\" | \"awsRDSLatency\" | \"awsSQSMessagesVisible\" | \"awsSQSMessagesDelayed\" | \"awsSQSMessagesSent\" | \"awsSQSMessagesEmpty\" | \"awsSQSOldestMessage\" | \"custom\"" } ``` ### How to Test - Start a local Kibana instance pointing to an oblt cluster. - Navigate to `Infrastructure`. - Try different asset types and navigate to the Node Details view. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../common/inventory_models/host/index.ts | 18 - .../inventory_models/host/metrics/index.ts | 35 -- .../host/metrics/tsvb/host_cpu_usage.ts | 254 ------------ .../host/metrics/tsvb/host_docker_info.ts | 56 --- .../host/metrics/tsvb/host_docker_overview.ts | 67 ---- .../metrics/tsvb/host_docker_top_5_by_cpu.ts | 37 -- .../tsvb/host_docker_top_5_by_memory.ts | 37 -- .../host/metrics/tsvb/host_filesystem.ts | 38 -- .../host/metrics/tsvb/host_k8s_cpu_cap.ts | 58 --- .../host/metrics/tsvb/host_k8s_disk_cap.ts | 45 --- .../host/metrics/tsvb/host_k8s_memory_cap.ts | 46 --- .../host/metrics/tsvb/host_k8s_overview.ts | 155 -------- .../host/metrics/tsvb/host_k8s_pod_cap.ts | 47 --- .../host/metrics/tsvb/host_load.ts | 56 --- .../host/metrics/tsvb/host_memory_usage.ts | 78 ---- .../host/metrics/tsvb/host_network_traffic.ts | 109 ----- .../host/metrics/tsvb/host_system_overview.ts | 130 ------ .../inventory_models/shared/metrics/index.ts | 12 - .../shared/metrics/required_metrics.ts | 9 - .../metrics/tsvb/aws_cpu_utilization.ts | 35 -- .../shared/metrics/tsvb/aws_diskio_bytes.ts | 84 ---- .../shared/metrics/tsvb/aws_diskio_ops.ts | 83 ---- .../shared/metrics/tsvb/aws_network_bytes.ts | 86 ---- .../metrics/tsvb/aws_network_packets.ts | 52 --- .../shared/metrics/tsvb/aws_overview.ts | 65 --- .../infra/common/inventory_models/types.ts | 25 +- .../asset_details/hooks/use_metadata.ts | 37 +- .../asset_details/hooks/use_metadata_state.ts | 11 +- .../node_details/tabs/osquery/index.tsx | 13 +- .../node_details/tabs/properties/index.tsx | 13 +- .../metric_detail/components/layout.tsx | 5 +- .../layouts/aws_layout_sections.tsx | 242 ----------- .../components/layouts/host_layout.tsx | 376 ------------------ .../metric_detail/metric_detail_page.tsx | 8 +- .../infra/server/routes/node_details/index.ts | 60 ++- .../translations/translations/fr-FR.json | 47 +-- .../translations/translations/ja-JP.json | 47 +-- .../translations/translations/zh-CN.json | 47 +-- .../apis/metrics_ui/metrics.ts | 40 +- 39 files changed, 105 insertions(+), 2558 deletions(-) delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts delete mode 100644 x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts delete mode 100644 x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/aws_layout_sections.tsx delete mode 100644 x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/host_layout.tsx diff --git a/x-pack/plugins/infra/common/inventory_models/host/index.ts b/x-pack/plugins/infra/common/inventory_models/host/index.ts index 04aa00fbdf2b..18af8bbfadc9 100644 --- a/x-pack/plugins/infra/common/inventory_models/host/index.ts +++ b/x-pack/plugins/infra/common/inventory_models/host/index.ts @@ -8,10 +8,6 @@ import { i18n } from '@kbn/i18n'; import { metrics } from './metrics'; import { InventoryModel } from '../types'; -import { - aws as awsRequiredMetrics, - nginx as nginxRequireMetrics, -} from '../shared/metrics/required_metrics'; export { hostSnapshotMetricTypes } from './metrics'; @@ -38,19 +34,5 @@ export const host: InventoryModel = { cloudProvider: 'cloud.provider', }, metrics, - requiredMetrics: [ - 'hostSystemOverview', - 'hostCpuUsage', - 'hostLoad', - 'hostMemoryUsage', - 'hostNetworkTraffic', - 'hostK8sOverview', - 'hostK8sCpuCap', - 'hostK8sMemoryCap', - 'hostK8sDiskCap', - 'hostK8sPodCap', - ...awsRequiredMetrics, - ...nginxRequireMetrics, - ], tooltipMetrics: ['cpu', 'memory', 'tx', 'rx'], }; diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts index e59aaefb2b82..3eff64ccb6a7 100644 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts +++ b/x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts @@ -18,24 +18,6 @@ import { normalizedLoad1m } from './snapshot/normalized_load_1m'; import { rx } from './snapshot/rx'; import { tx } from './snapshot/tx'; -import { hostSystemOverview } from './tsvb/host_system_overview'; -import { hostCpuUsage } from './tsvb/host_cpu_usage'; -import { hostLoad } from './tsvb/host_load'; -import { hostMemoryUsage } from './tsvb/host_memory_usage'; -import { hostNetworkTraffic } from './tsvb/host_network_traffic'; -import { hostFilesystem } from './tsvb/host_filesystem'; - -import { hostK8sOverview } from './tsvb/host_k8s_overview'; -import { hostK8sCpuCap } from './tsvb/host_k8s_cpu_cap'; -import { hostK8sPodCap } from './tsvb/host_k8s_pod_cap'; -import { hostK8sDiskCap } from './tsvb/host_k8s_disk_cap'; -import { hostK8sMemoryCap } from './tsvb/host_k8s_memory_cap'; - -import { hostDockerTop5ByMemory } from './tsvb/host_docker_top_5_by_memory'; -import { hostDockerTop5ByCpu } from './tsvb/host_docker_top_5_by_cpu'; -import { hostDockerOverview } from './tsvb/host_docker_overview'; -import { hostDockerInfo } from './tsvb/host_docker_info'; - import { InventoryMetrics } from '../../types'; const exposedHostSnapshotMetrics = { @@ -59,23 +41,6 @@ export const hostSnapshotMetricTypes = Object.keys(exposedHostSnapshotMetrics) a >; export const metrics: InventoryMetrics = { - tsvb: { - hostSystemOverview, - hostCpuUsage, - hostLoad, - hostMemoryUsage, - hostNetworkTraffic, - hostFilesystem, - hostK8sOverview, - hostK8sCpuCap, - hostK8sPodCap, - hostK8sDiskCap, - hostK8sMemoryCap, - hostDockerOverview, - hostDockerInfo, - hostDockerTop5ByMemory, - hostDockerTop5ByCpu, - }, snapshot: hostSnapshotMetrics, defaultSnapshot: 'cpu', defaultTimeRangeInSeconds: 3600, // 1 hour diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts deleted file mode 100644 index bcafeb4ebc4c..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts +++ /dev/null @@ -1,254 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostCpuUsage: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostCpuUsage', - requires: ['system.cpu'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'user', - metrics: [ - { - field: 'system.cpu.user.pct', - id: 'avg-cpu-user', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-user', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'system', - metrics: [ - { - field: 'system.cpu.system.pct', - id: 'avg-cpu-system', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-system', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'steal', - metrics: [ - { - field: 'system.cpu.steal.pct', - id: 'avg-cpu-steal', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'avg-cpu-steal', - id: 'var-avg', - name: 'avg', - }, - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'irq', - metrics: [ - { - field: 'system.cpu.irq.pct', - id: 'avg-cpu-irq', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-irq', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'softirq', - metrics: [ - { - field: 'system.cpu.softirq.pct', - id: 'avg-cpu-softirq', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-softirq', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'iowait', - metrics: [ - { - field: 'system.cpu.iowait.pct', - id: 'avg-cpu-iowait', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-iowait', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'nice', - metrics: [ - { - field: 'system.cpu.nice.pct', - id: 'avg-cpu-nice', - type: 'avg', - }, - { - field: 'system.cpu.cores', - id: 'max-cpu-cores', - type: 'max', - }, - { - id: 'calc-avg-cores', - script: 'params.avg / params.cores', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cores', - id: 'var-cores', - name: 'cores', - }, - { - field: 'avg-cpu-nice', - id: 'var-avg', - name: 'avg', - }, - ], - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts deleted file mode 100644 index 4cc2b574362d..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostDockerInfo: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostDockerInfo', - requires: ['docker.info'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'running', - metrics: [ - { - field: 'docker.info.containers.running', - id: 'max-running', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'paused', - metrics: [ - { - field: 'docker.info.containers.paused', - id: 'max-paused', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'stopped', - metrics: [ - { - field: 'docker.info.containers.stopped', - id: 'max-stopped', - type: 'max', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts deleted file mode 100644 index df56a21dbf5b..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostDockerOverview: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostDockerOverview', - requires: ['docker.info'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'top_n', - series: [ - { - id: 'total', - metrics: [ - { - field: 'docker.info.containers.total', - id: 'max-total', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'running', - metrics: [ - { - field: 'docker.info.containers.running', - id: 'max-running', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'paused', - metrics: [ - { - field: 'docker.info.containers.paused', - id: 'max-paused', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'stopped', - metrics: [ - { - field: 'docker.info.containers.stopped', - id: 'max-stopped', - type: 'max', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts deleted file mode 100644 index fd9eb9741973..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostDockerTop5ByCpu: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostDockerTop5ByCpu', - requires: ['docker.cpu'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'avg-cpu', - metrics: [ - { - field: 'docker.cpu.total.pct', - id: 'avg-cpu-metric', - type: 'avg', - }, - ], - split_mode: 'terms', - terms_field: 'container.name', - terms_order_by: 'avg-cpu', - terms_size: 5, - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts deleted file mode 100644 index cad828671d23..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostDockerTop5ByMemory: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostDockerTop5ByMemory', - requires: ['docker.memory'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'avg-memory', - metrics: [ - { - field: 'docker.memory.usage.pct', - id: 'avg-memory-metric', - type: 'avg', - }, - ], - split_mode: 'terms', - terms_field: 'container.name', - terms_order_by: 'avg-memory', - terms_size: 5, - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts deleted file mode 100644 index ce284345410f..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostFilesystem: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostFilesystem', - requires: ['system.filesystem'], - filter: 'system.filesystem.device_name:\\/*', - index_pattern: indexPattern, - time_field: timeField, - interval, - type: 'timeseries', - series: [ - { - id: 'used', - metrics: [ - { - field: 'system.filesystem.used.pct', - id: 'avg-filesystem-used', - type: 'avg', - }, - ], - split_mode: 'terms', - terms_field: 'system.filesystem.device_name', - terms_order_by: 'used', - terms_size: 5, - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts deleted file mode 100644 index d33e4cdeb34c..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostK8sCpuCap: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostK8sCpuCap', - map_field_to: 'kubernetes.node.name', - requires: ['kubernetes.node'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'capacity', - metrics: [ - { - field: 'kubernetes.node.cpu.allocatable.cores', - id: 'max-cpu-cap', - type: 'max', - }, - { - id: 'calc-nanocores', - type: 'calculation', - variables: [ - { - id: 'var-cores', - field: 'max-cpu-cap', - name: 'cores', - }, - ], - script: 'params.cores * 1000000000', - }, - ], - split_mode: 'everything', - }, - { - id: 'used', - metrics: [ - { - field: 'kubernetes.node.cpu.usage.nanocores', - id: 'avg-cpu-usage', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts deleted file mode 100644 index e9e512a13663..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; -export const hostK8sDiskCap: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostK8sDiskCap', - map_field_to: 'kubernetes.node.name', - requires: ['kubernetes.node'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'capacity', - metrics: [ - { - field: 'kubernetes.node.fs.capacity.bytes', - id: 'max-fs-cap', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'used', - metrics: [ - { - field: 'kubernetes.node.fs.used.bytes', - id: 'avg-fs-used', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts deleted file mode 100644 index ccc227ef1854..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostK8sMemoryCap: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostK8sMemoryCap', - map_field_to: 'kubernetes.node.name', - requires: ['kubernetes.node'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'capacity', - metrics: [ - { - field: 'kubernetes.node.memory.allocatable.bytes', - id: 'max-memory-cap', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'used', - metrics: [ - { - field: 'kubernetes.node.memory.usage.bytes', - id: 'avg-memory-usage', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts deleted file mode 100644 index 2da74d50dff1..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostK8sOverview: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostK8sOverview', - requires: ['kubernetes'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'top_n', - series: [ - { - id: 'cpucap', - split_mode: 'everything', - metrics: [ - { - field: 'kubernetes.node.cpu.allocatable.cores', - id: 'max-cpu-cap', - type: 'max', - }, - { - field: 'kubernetes.node.cpu.usage.nanocores', - id: 'avg-cpu-usage', - type: 'avg', - }, - { - id: 'calc-used-cap', - script: 'params.used / (params.cap * 1000000000)', - type: 'calculation', - variables: [ - { - field: 'max-cpu-cap', - id: 'var-cap', - name: 'cap', - }, - { - field: 'avg-cpu-usage', - id: 'var-used', - name: 'used', - }, - ], - }, - ], - }, - { - id: 'diskcap', - metrics: [ - { - field: 'kubernetes.node.fs.capacity.bytes', - id: 'max-fs-cap', - type: 'max', - }, - { - field: 'kubernetes.node.fs.used.bytes', - id: 'avg-fs-used', - type: 'avg', - }, - { - id: 'calc-used-cap', - script: 'params.used / params.cap', - type: 'calculation', - variables: [ - { - field: 'max-fs-cap', - id: 'var-cap', - name: 'cap', - }, - { - field: 'avg-fs-used', - id: 'var-used', - name: 'used', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'memorycap', - metrics: [ - { - field: 'kubernetes.node.memory.allocatable.bytes', - id: 'max-memory-cap', - type: 'max', - }, - { - field: 'kubernetes.node.memory.usage.bytes', - id: 'avg-memory-usage', - type: 'avg', - }, - { - id: 'calc-used-cap', - script: 'params.used / params.cap', - type: 'calculation', - variables: [ - { - field: 'max-memory-cap', - id: 'var-cap', - name: 'cap', - }, - { - field: 'avg-memory-usage', - id: 'var-used', - name: 'used', - }, - ], - }, - ], - split_mode: 'everything', - }, - { - id: 'podcap', - metrics: [ - { - field: 'kubernetes.node.pod.capacity.total', - id: 'max-pod-cap', - type: 'max', - }, - { - field: 'kubernetes.pod.uid', - id: 'card-pod-name', - type: 'cardinality', - }, - { - id: 'calc-used-cap', - script: 'params.used / params.cap', - type: 'calculation', - variables: [ - { - field: 'max-pod-cap', - id: 'var-cap', - name: 'cap', - }, - { - field: 'card-pod-name', - id: 'var-used', - name: 'used', - }, - ], - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts deleted file mode 100644 index 85cb798eaf9b..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostK8sPodCap: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostK8sPodCap', - requires: ['kubernetes.node'], - map_field_to: 'kubernetes.node.name', - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - - series: [ - { - id: 'capacity', - metrics: [ - { - field: 'kubernetes.node.pod.allocatable.total', - id: 'max-pod-cap', - type: 'max', - }, - ], - split_mode: 'everything', - }, - { - id: 'used', - metrics: [ - { - field: 'kubernetes.pod.uid', - id: 'avg-pod', - type: 'cardinality', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts deleted file mode 100644 index bef170c743e6..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostLoad: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostLoad', - requires: ['system.cpu'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'load_1m', - metrics: [ - { - field: 'system.load.1', - id: 'avg-load-1m', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - { - id: 'load_5m', - metrics: [ - { - field: 'system.load.5', - id: 'avg-load-5m', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - { - id: 'load_15m', - metrics: [ - { - field: 'system.load.15', - id: 'avg-load-15m', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts deleted file mode 100644 index bda81dea4bd2..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostMemoryUsage: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostMemoryUsage', - requires: ['system.memory'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'free', - metrics: [ - { - field: 'system.memory.free', - id: 'avg-memory-free', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - { - id: 'used', - metrics: [ - { - field: 'system.memory.actual.used.bytes', - id: 'avg-memory-used', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - { - id: 'cache', - metrics: [ - { - field: 'system.memory.actual.used.bytes', - id: 'avg-memory-actual-used', - type: 'avg', - }, - { - field: 'system.memory.used.bytes', - id: 'avg-memory-used', - type: 'avg', - }, - { - id: 'calc-used-actual', - script: 'params.used - params.actual', - type: 'calculation', - variables: [ - { - field: 'avg-memory-actual-used', - id: 'var-actual', - name: 'actual', - }, - { - field: 'avg-memory-used', - id: 'var-used', - name: 'used', - }, - ], - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts deleted file mode 100644 index b3dfc5e91ba0..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostNetworkTraffic: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostNetworkTraffic', - requires: ['system.network'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'tx', - metrics: [ - { - field: 'host.network.egress.bytes', - id: 'avg-net-out', - type: 'avg', - }, - { - id: 'max-period', - type: 'max', - field: 'metricset.period', - }, - { - id: '3216b170-f192-11ec-a8e3-dd984b7213e2', - type: 'calculation', - variables: [ - { - id: '34e64c30-f192-11ec-a8e3-dd984b7213e2', - name: 'value', - field: 'avg-net-out', - }, - { - id: '3886cb80-f192-11ec-a8e3-dd984b7213e2', - name: 'period', - field: 'max-period', - }, - ], - script: 'params.value / (params.period / 1000)', - }, - ], - filter: { - language: 'kuery', - query: 'host.network.egress.bytes : * ', - }, - split_mode: 'everything', - }, - { - id: 'rx', - metrics: [ - { - field: 'host.network.ingress.bytes', - id: 'avg-net-in', - type: 'avg', - }, - { - id: 'calc-invert-rate', - script: 'params.rate * -1', - type: 'calculation', - variables: [ - { - field: 'avg-net-in', - id: 'var-rate', - name: 'rate', - }, - ], - }, - { - id: 'max-period', - type: 'max', - field: 'metricset.period', - }, - { - id: '3216b170-f192-11ec-a8e3-dd984b7213e2', - type: 'calculation', - variables: [ - { - id: '34e64c30-f192-11ec-a8e3-dd984b7213e2', - name: 'value', - field: 'calc-invert-rate', - }, - { - id: '3886cb80-f192-11ec-a8e3-dd984b7213e2', - name: 'period', - field: 'max-period', - }, - ], - script: 'params.value / (params.period / 1000)', - }, - ], - filter: { - language: 'kuery', - query: 'host.network.ingress.bytes : * ', - }, - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts deleted file mode 100644 index 69ebd0aa3594..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const hostSystemOverview: TSVBMetricModelCreator = ( - timeField, - indexPattern, - interval -): TSVBMetricModel => ({ - id: 'hostSystemOverview', - requires: ['system.cpu', 'system.memory', 'system.load', 'system.network'], - index_pattern: indexPattern, - interval, - time_field: timeField, - type: 'top_n', - series: [ - { - id: 'cpu', - split_mode: 'everything', - metrics: [ - { - field: 'system.cpu.total.norm.pct', - id: 'avg-cpu-total', - type: 'avg', - }, - ], - }, - { - id: 'load', - split_mode: 'everything', - metrics: [ - { - field: 'system.load.5', - id: 'avg-load-5m', - type: 'avg', - }, - ], - }, - { - id: 'memory', - split_mode: 'everything', - metrics: [ - { - field: 'system.memory.actual.used.pct', - id: 'avg-memory-actual-used', - type: 'avg', - }, - ], - }, - { - id: 'rx', - metrics: [ - { - field: 'host.network.ingress.bytes', - id: 'avg-net-in', - type: 'avg', - }, - { - id: 'max-period', - type: 'max', - field: 'metricset.period', - }, - { - id: '3216b170-f192-11ec-a8e3-dd984b7213e2', - type: 'calculation', - variables: [ - { - id: '34e64c30-f192-11ec-a8e3-dd984b7213e2', - name: 'value', - field: 'avg-net-in', - }, - { - id: '3886cb80-f192-11ec-a8e3-dd984b7213e2', - name: 'period', - field: 'max-period', - }, - ], - script: 'params.value / (params.period / 1000)', - }, - ], - filter: { - language: 'kuery', - query: 'host.network.ingress.bytes : * ', - }, - split_mode: 'everything', - }, - { - id: 'tx', - metrics: [ - { - field: 'host.network.egress.bytes', - id: 'avg-net-out', - type: 'avg', - }, - { - id: 'max-period', - type: 'max', - field: 'metricset.period', - }, - { - id: '3216b170-f192-11ec-a8e3-dd984b7213e2', - type: 'calculation', - variables: [ - { - id: '34e64c30-f192-11ec-a8e3-dd984b7213e2', - name: 'value', - field: 'avg-net-out', - }, - { - id: '3886cb80-f192-11ec-a8e3-dd984b7213e2', - name: 'period', - field: 'max-period', - }, - ], - script: 'params.value / (params.period / 1000)', - }, - ], - filter: { - language: 'kuery', - query: 'host.network.egress.bytes : * ', - }, - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts index 775dff525b7f..2dac80de5116 100644 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts +++ b/x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts @@ -10,12 +10,6 @@ import { nginxActiveConnections } from './tsvb/nginx_active_connections'; import { nginxHits } from './tsvb/nginx_hits'; import { nginxRequestsPerConnection } from './tsvb/nginx_requests_per_connection'; -import { awsCpuUtilization } from './tsvb/aws_cpu_utilization'; -import { awsDiskioBytes } from './tsvb/aws_diskio_bytes'; -import { awsDiskioOps } from './tsvb/aws_diskio_ops'; -import { awsNetworkBytes } from './tsvb/aws_network_bytes'; -import { awsNetworkPackets } from './tsvb/aws_network_packets'; -import { awsOverview } from './tsvb/aws_overview'; import { InventoryMetrics } from '../../types'; import { count } from './snapshot/count'; @@ -25,12 +19,6 @@ export const metrics: InventoryMetrics = { nginxHits, nginxRequestRate, nginxRequestsPerConnection, - awsCpuUtilization, - awsDiskioBytes, - awsDiskioOps, - awsNetworkBytes, - awsNetworkPackets, - awsOverview, }, snapshot: { count, diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts index 5b29fc93e0d0..172b48a1ba68 100644 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts +++ b/x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts @@ -13,12 +13,3 @@ export const nginx: InventoryMetric[] = [ 'nginxActiveConnections', 'nginxRequestsPerConnection', ]; - -export const aws: InventoryMetric[] = [ - 'awsOverview', - 'awsCpuUtilization', - 'awsNetworkBytes', - 'awsNetworkPackets', - 'awsDiskioOps', - 'awsDiskioBytes', -]; diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts deleted file mode 100644 index 51b9a4cfc7b3..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const awsCpuUtilization: TSVBMetricModelCreator = ( - timeField, - indexPattern -): TSVBMetricModel => ({ - id: 'awsCpuUtilization', - requires: ['aws.ec2'], - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - index_pattern: indexPattern, - interval: '>=5m', - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'cpu-util', - metrics: [ - { - field: 'aws.ec2.cpu.total.pct', - id: 'avg-cpu-util', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts deleted file mode 100644 index 5224545c006b..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const awsDiskioBytes: TSVBMetricModelCreator = ( - timeField, - indexPattern -): TSVBMetricModel => ({ - id: 'awsDiskioBytes', - requires: ['aws.ec2'], - index_pattern: indexPattern, - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - interval: '>=5m', - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'writes', - metrics: [ - { - field: 'aws.ec2.diskio.write.bytes', - id: 'sum-diskio-out', - type: 'sum', - }, - { - id: 'csum-sum-diskio-out', - field: 'sum-diskio-out', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-diskio-out', - unit: '1s', - type: 'derivative', - field: 'csum-sum-diskio-out', - }, - { - id: 'posonly-deriv-csum-sum-diskio-out', - field: 'deriv-csum-sum-diskio-out', - type: 'positive_only', - }, - ], - split_mode: 'everything', - }, - { - id: 'reads', - metrics: [ - { - field: 'aws.ec2.diskio.read.bytes', - id: 'sum-diskio-in', - type: 'sum', - }, - { - id: 'csum-sum-diskio-in', - field: 'sum-diskio-in', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-diskio-in', - unit: '1s', - type: 'derivative', - field: 'csum-sum-diskio-in', - }, - { - id: 'posonly-deriv-csum-sum-diskio-in', - field: 'deriv-csum-sum-diskio-in', - type: 'positive_only', - }, - { - id: 'inverted-posonly-deriv-csum-sum-diskio-in', - type: 'calculation', - variables: [{ id: 'var-rate', name: 'rate', field: 'posonly-deriv-csum-sum-diskio-in' }], - script: 'params.rate * -1', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts deleted file mode 100644 index c362a6d88c27..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const awsDiskioOps: TSVBMetricModelCreator = (timeField, indexPattern): TSVBMetricModel => ({ - id: 'awsDiskioOps', - requires: ['aws.ec2'], - index_pattern: indexPattern, - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - interval: '>=5m', - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'writes', - metrics: [ - { - field: 'aws.ec2.diskio.write.count', - id: 'sum-diskio-writes', - type: 'sum', - }, - { - id: 'csum-sum-diskio-writes', - field: 'sum-diskio-writes', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-diskio-writes', - unit: '1s', - type: 'derivative', - field: 'csum-sum-diskio-writes', - }, - { - id: 'posonly-deriv-csum-sum-diskio-writes', - field: 'deriv-csum-sum-diskio-writes', - type: 'positive_only', - }, - ], - split_mode: 'everything', - }, - { - id: 'reads', - metrics: [ - { - field: 'aws.ec2.diskio.read.count', - id: 'sum-diskio-reads', - type: 'sum', - }, - { - id: 'csum-sum-diskio-reads', - field: 'sum-diskio-reads', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-diskio-reads', - unit: '1s', - type: 'derivative', - field: 'csum-sum-diskio-reads', - }, - { - id: 'posonly-deriv-csum-sum-diskio-reads', - field: 'deriv-csum-sum-diskio-reads', - type: 'positive_only', - }, - { - id: 'inverted-posonly-deriv-csum-sum-diskio-reads', - type: 'calculation', - variables: [ - { id: 'var-rate', name: 'rate', field: 'posonly-deriv-csum-sum-diskio-reads' }, - ], - script: 'params.rate * -1', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts deleted file mode 100644 index b142feb95450..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -// see discussion in: https://github.com/elastic/kibana/issues/42687 - -export const awsNetworkBytes: TSVBMetricModelCreator = ( - timeField, - indexPattern -): TSVBMetricModel => ({ - id: 'awsNetworkBytes', - requires: ['aws.ec2'], - index_pattern: indexPattern, - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - interval: '>=5m', - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'tx', - metrics: [ - { - field: 'aws.ec2.network.out.bytes', - id: 'sum-net-out', - type: 'sum', - }, - { - id: 'csum-sum-net-out', - field: 'sum-net-out', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-net-out', - unit: '1s', - type: 'derivative', - field: 'csum-sum-net-out', - }, - { - id: 'posonly-deriv-csum-sum-net-out', - field: 'deriv-csum-sum-net-out', - type: 'positive_only', - }, - ], - split_mode: 'everything', - }, - { - id: 'rx', - metrics: [ - { - field: 'aws.ec2.network.in.bytes', - id: 'sum-net-in', - type: 'sum', - }, - { - id: 'csum-sum-net-in', - field: 'sum-net-in', - type: 'cumulative_sum', - }, - { - id: 'deriv-csum-sum-net-in', - unit: '1s', - type: 'derivative', - field: 'csum-sum-net-in', - }, - { - id: 'posonly-deriv-csum-sum-net-in', - field: 'deriv-csum-sum-net-in', - type: 'positive_only', - }, - { - id: 'inverted-posonly-deriv-csum-sum-net-in', - type: 'calculation', - variables: [{ id: 'var-rate', name: 'rate', field: 'posonly-deriv-csum-sum-net-in' }], - script: 'params.rate * -1', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts deleted file mode 100644 index 9d39582b6686..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const awsNetworkPackets: TSVBMetricModelCreator = ( - timeField, - indexPattern -): TSVBMetricModel => ({ - id: 'awsNetworkPackets', - requires: ['aws.ec2'], - index_pattern: indexPattern, - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - interval: '>=5m', - time_field: timeField, - type: 'timeseries', - series: [ - { - id: 'packets-out', - metrics: [ - { - field: 'aws.ec2.network.out.packets', - id: 'avg-net-out', - type: 'avg', - }, - ], - split_mode: 'everything', - }, - { - id: 'packets-in', - metrics: [ - { - field: 'aws.ec2.network.in.packets', - id: 'avg-net-in', - type: 'avg', - }, - { - id: 'inverted-avg-net-in', - type: 'calculation', - variables: [{ id: 'var-avg', name: 'avg', field: 'avg-net-in' }], - script: 'params.avg * -1', - }, - ], - split_mode: 'everything', - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts deleted file mode 100644 index 3fe12d62d335..000000000000 --- a/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 { TSVBMetricModelCreator, TSVBMetricModel } from '../../../types'; - -export const awsOverview: TSVBMetricModelCreator = (timeField, indexPattern): TSVBMetricModel => ({ - id: 'awsOverview', - requires: ['aws.ec2'], - index_pattern: indexPattern, - map_field_to: 'cloud.instance.id', - id_type: 'cloud', - interval: '>=5m', - time_field: timeField, - type: 'top_n', - series: [ - { - id: 'cpu-util', - split_mode: 'everything', - metrics: [ - { - field: 'aws.ec2.cpu.total.pct', - id: 'cpu-total-pct', - type: 'max', - }, - ], - }, - { - id: 'status-check-failed', - split_mode: 'everything', - metrics: [ - { - field: 'aws.ec2.status.check_failed', - id: 'status-check-failed', - type: 'max', - }, - ], - }, - { - id: 'packets-out', - split_mode: 'everything', - metrics: [ - { - field: 'aws.ec2.network.out.packets', - id: 'network-out-packets', - type: 'avg', - }, - ], - }, - { - id: 'packets-in', - split_mode: 'everything', - metrics: [ - { - field: 'aws.ec2.network.in.packets', - id: 'network-in-packets', - type: 'avg', - }, - ], - }, - ], -}); diff --git a/x-pack/plugins/infra/common/inventory_models/types.ts b/x-pack/plugins/infra/common/inventory_models/types.ts index 5bc36429e2ba..fd52c1c230c1 100644 --- a/x-pack/plugins/infra/common/inventory_models/types.ts +++ b/x-pack/plugins/infra/common/inventory_models/types.ts @@ -37,21 +37,6 @@ export type InventoryFormatterType = rt.TypeOf; export type InventoryItemType = rt.TypeOf; export const InventoryMetricRT = rt.keyof({ - hostSystemOverview: null, - hostCpuUsage: null, - hostFilesystem: null, - hostK8sOverview: null, - hostK8sCpuCap: null, - hostK8sDiskCap: null, - hostK8sMemoryCap: null, - hostK8sPodCap: null, - hostLoad: null, - hostMemoryUsage: null, - hostNetworkTraffic: null, - hostDockerOverview: null, - hostDockerInfo: null, - hostDockerTop5ByCpu: null, - hostDockerTop5ByMemory: null, podOverview: null, podCpuUsage: null, podMemoryUsage: null, @@ -71,12 +56,6 @@ export const InventoryMetricRT = rt.keyof({ nginxRequestRate: null, nginxActiveConnections: null, nginxRequestsPerConnection: null, - awsOverview: null, - awsCpuUtilization: null, - awsNetworkBytes: null, - awsNetworkPackets: null, - awsDiskioBytes: null, - awsDiskioOps: null, awsEC2CpuUtilization: null, awsEC2NetworkTraffic: null, awsEC2DiskIOBytes: null, @@ -377,7 +356,7 @@ export const SnapshotMetricTypeRT = rt.keyof(SnapshotMetricTypeKeys); export type SnapshotMetricType = rt.TypeOf; export interface InventoryMetrics { - tsvb: { [name: string]: TSVBMetricModelCreator }; + tsvb?: { [name: string]: TSVBMetricModelCreator }; snapshot: { [name: string]: MetricsUIAggregation | undefined }; defaultSnapshot: SnapshotMetricType; /** This is used by the inventory view to calculate the appropriate amount of time for the metrics detail page. Some metris like awsS3 require multiple days where others like host only need an hour.*/ @@ -403,7 +382,7 @@ export interface InventoryModel { uptime: boolean; }; metrics: InventoryMetrics; - requiredMetrics: InventoryMetric[]; + requiredMetrics?: InventoryMetric[]; tooltipMetrics: SnapshotMetricType[]; nodeFilter?: object[]; } diff --git a/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata.ts b/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata.ts index 2750394da702..c06344270c2f 100644 --- a/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata.ts +++ b/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata.ts @@ -15,16 +15,23 @@ import { throwErrors, createPlainError } from '../../../../common/runtime_types' import { getFilteredMetrics } from '../../../pages/metrics/metric_detail/lib/get_filtered_metrics'; import type { InventoryItemType, InventoryMetric } from '../../../../common/inventory_models/types'; -export function useMetadata( - nodeId: string, - nodeType: InventoryItemType, - requiredMetrics: InventoryMetric[], - sourceId: string, +interface UseMetadataProps { + assetId: string; + assetType: InventoryItemType; + requiredMetrics?: InventoryMetric[]; + sourceId: string; timeRange: { from: number; to: number; - } -) { + }; +} +export function useMetadata({ + assetId, + assetType, + sourceId, + timeRange, + requiredMetrics = [], +}: UseMetadataProps) { const decodeResponse = (response: any) => { return pipe(InfraMetadataRT.decode(response), fold(throwErrors(createPlainError), identity)); }; @@ -32,8 +39,8 @@ export function useMetadata( '/api/infra/metadata', 'POST', JSON.stringify({ - nodeId, - nodeType, + nodeId: assetId, + nodeType: assetType, sourceId, timeRange, }), @@ -49,17 +56,13 @@ export function useMetadata( return { name: (response && response.name) || '', filteredRequiredMetrics: - (response && getFilteredMetrics(requiredMetrics, response.features)) || [], + response && requiredMetrics.length > 0 + ? getFilteredMetrics(requiredMetrics, response.features) + : [], error: (error && error.message) || null, loading, metadata: response, - cloudId: - (response && - response.info && - response.info.cloud && - response.info.cloud.instance && - response.info.cloud.instance.id) || - '', + cloudId: response?.info?.cloud?.instance?.id || '', reload: makeRequest, }; } diff --git a/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata_state.ts b/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata_state.ts index 4d0f0c66f67c..0df9ae9a152d 100644 --- a/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata_state.ts +++ b/x-pack/plugins/infra/public/components/asset_details/hooks/use_metadata_state.ts @@ -7,7 +7,6 @@ import { useEffect, useCallback } from 'react'; import createContainer from 'constate'; -import { findInventoryModel } from '../../../../common/inventory_models'; import { useSourceContext } from '../../../containers/metrics_source'; import { useMetadata } from './use_metadata'; import { AssetDetailsProps } from '../types'; @@ -19,16 +18,14 @@ export type UseMetadataProviderProps = Pick { reload(); diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx index 26ff945d0402..7339043ffa98 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx @@ -11,7 +11,6 @@ import React, { useMemo } from 'react'; import { useKibanaContextForPlugin } from '../../../../../../../hooks/use_kibana'; import { TabContent, TabProps } from '../shared'; import { useSourceContext } from '../../../../../../../containers/metrics_source'; -import { findInventoryModel } from '../../../../../../../../common/inventory_models'; import { InventoryItemType } from '../../../../../../../../common/inventory_models/types'; import { useMetadata } from '../../../../../../../components/asset_details/hooks/use_metadata'; import { useWaffleTimeContext } from '../../../../hooks/use_waffle_time'; @@ -19,16 +18,14 @@ import { useWaffleTimeContext } from '../../../../hooks/use_waffle_time'; const TabComponent = (props: TabProps) => { const nodeId = props.node.id; const nodeType = props.nodeType as InventoryItemType; - const inventoryModel = findInventoryModel(nodeType); const { sourceId } = useSourceContext(); const { currentTimeRange } = useWaffleTimeContext(); - const { loading, metadata } = useMetadata( - nodeId, - nodeType, - inventoryModel.requiredMetrics, + const { loading, metadata } = useMetadata({ + assetId: nodeId, + assetType: nodeType, sourceId, - currentTimeRange - ); + timeRange: currentTimeRange, + }); const { services: { osquery }, } = useKibanaContextForPlugin(); diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/properties/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/properties/index.tsx index bc0ee279b2cb..c8550a4d0516 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/properties/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/properties/index.tsx @@ -11,7 +11,6 @@ import { EuiLoadingChart } from '@elastic/eui'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { TabContent, TabProps } from '../shared'; import { useSourceContext } from '../../../../../../../containers/metrics_source'; -import { findInventoryModel } from '../../../../../../../../common/inventory_models'; import { InventoryItemType } from '../../../../../../../../common/inventory_models/types'; import { useMetadata } from '../../../../../../../components/asset_details/hooks/use_metadata'; import { getFields } from './build_fields'; @@ -22,17 +21,15 @@ import { useWaffleFiltersContext } from '../../../../hooks/use_waffle_filters'; const TabComponent = (props: TabProps) => { const nodeId = props.node.id; const nodeType = props.nodeType as InventoryItemType; - const inventoryModel = findInventoryModel(nodeType); const { sourceId } = useSourceContext(); const { currentTimeRange } = useWaffleTimeContext(); const { applyFilterQuery } = useWaffleFiltersContext(); - const { loading: metadataLoading, metadata } = useMetadata( - nodeId, - nodeType, - inventoryModel.requiredMetrics, + const { loading: metadataLoading, metadata } = useMetadata({ + assetId: nodeId, + assetType: nodeType, sourceId, - currentTimeRange - ); + timeRange: currentTimeRange, + }); const hostFields = useMemo(() => { if (!metadata) return null; diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layout.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layout.tsx index a2b48e9b7f2f..c89fa6f7fe60 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layout.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layout.tsx @@ -13,7 +13,6 @@ import { AwsRDSLayout } from './layouts/aws_rds_layout'; import { AwsS3Layout } from './layouts/aws_s3_layout'; import { AwsSQSLayout } from './layouts/aws_sqs_layout'; import { ContainerLayout } from './layouts/container_layout'; -import { HostLayout } from './layouts/host_layout'; import { PodLayout } from './layouts/pod_layout'; export const Layout = ({ @@ -31,9 +30,9 @@ export const Layout = ({ return ; case 'container': return ; - case 'host': - return ; case 'pod': return ; + default: + throw new Error(`${inventoryItemType} is not supported.`); } }; diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/aws_layout_sections.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/aws_layout_sections.tsx deleted file mode 100644 index 75c06c30b968..000000000000 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/aws_layout_sections.tsx +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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 { i18n } from '@kbn/i18n'; -import { withTheme } from '@kbn/kibana-react-plugin/common'; -import React from 'react'; -import type { LayoutPropsWithTheme } from '../../types'; -import { ChartSectionVis } from '../chart_section_vis'; -import { GaugesSectionVis } from '../gauges_section_vis'; -import { Section } from '../section'; -import { SubSection } from '../sub_section'; - -export const AwsLayoutSection = withTheme( - ({ metrics, onChangeRangeTime, theme }: LayoutPropsWithTheme) => ( - -
- - - - - - - - - - - - - - - - - - -
-
- ) -); diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/host_layout.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/host_layout.tsx deleted file mode 100644 index 41e0204bc7b2..000000000000 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/layouts/host_layout.tsx +++ /dev/null @@ -1,376 +0,0 @@ -/* - * 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 { EuiPanel } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { withTheme } from '@kbn/kibana-react-plugin/common'; -import React from 'react'; -import type { LayoutPropsWithTheme } from '../../types'; -import { ChartSectionVis } from '../chart_section_vis'; -import { GaugesSectionVis } from '../gauges_section_vis'; -import { MetadataDetails } from '../metadata_details'; -import { Section } from '../section'; -import { SubSection } from '../sub_section'; -import { AwsLayoutSection } from './aws_layout_sections'; -import { NginxLayoutSection } from './nginx_layout_sections'; - -export const HostLayout = withTheme( - ({ metrics, onChangeRangeTime, theme }: LayoutPropsWithTheme) => ( - - - -
- - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - -
- - -
-
- ) -); diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/metric_detail_page.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/metric_detail_page.tsx index 1f049814a23d..15425ef61804 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/metric_detail_page.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/metric_detail_page.tsx @@ -42,7 +42,13 @@ export const MetricDetailPage = () => { loading: metadataLoading, cloudId, metadata, - } = useMetadata(nodeId, nodeType, inventoryModel.requiredMetrics, sourceId, parsedTimeRange); + } = useMetadata({ + assetId: nodeId, + assetType: nodeType, + requiredMetrics: inventoryModel.requiredMetrics, + sourceId, + timeRange: parsedTimeRange, + }); const [sideNav, setSideNav] = useState([]); diff --git a/x-pack/plugins/infra/server/routes/node_details/index.ts b/x-pack/plugins/infra/server/routes/node_details/index.ts index cd92c902a110..56eccbbe160e 100644 --- a/x-pack/plugins/infra/server/routes/node_details/index.ts +++ b/x-pack/plugins/infra/server/routes/node_details/index.ts @@ -34,30 +34,46 @@ export const initNodeDetailsRoute = (libs: InfraBackendLibs) => { }, }, async (requestContext, request, response) => { - const { nodeId, cloudId, nodeType, metrics, timerange, sourceId } = pipe( - NodeDetailsRequestRT.decode(request.body), - fold(throwErrors(Boom.badRequest), identity) - ); - const soClient = (await requestContext.core).savedObjects.client; - const source = await libs.sources.getSourceConfiguration(soClient, sourceId); + try { + const { nodeId, cloudId, nodeType, metrics, timerange, sourceId } = pipe( + NodeDetailsRequestRT.decode(request.body), + fold(throwErrors(Boom.badRequest), identity) + ); + const soClient = (await requestContext.core).savedObjects.client; + const source = await libs.sources.getSourceConfiguration(soClient, sourceId); - UsageCollector.countNode(nodeType); + UsageCollector.countNode(nodeType); - const options: InfraMetricsRequestOptions = { - nodeIds: { - nodeId, - cloudId, - }, - nodeType, - sourceConfiguration: source.configuration, - metrics, - timerange, - }; - return response.ok({ - body: NodeDetailsMetricDataResponseRT.encode({ - metrics: await libs.metrics.getMetrics(requestContext, options, request), - }), - }); + const options: InfraMetricsRequestOptions = { + nodeIds: { + nodeId, + cloudId, + }, + nodeType, + sourceConfiguration: source.configuration, + metrics, + timerange, + }; + return response.ok({ + body: NodeDetailsMetricDataResponseRT.encode({ + metrics: await libs.metrics.getMetrics(requestContext, options, request), + }), + }); + } catch (err) { + if (Boom.isBoom(err)) { + return response.customError({ + statusCode: err.output.statusCode, + body: { message: err.output.payload.message }, + }); + } + + return response.customError({ + statusCode: err.statusCode ?? 500, + body: { + message: err.message ?? 'An unexpected error occurred', + }, + }); + } } ); }; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 260328513d6c..b468f00d0246 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -18996,25 +18996,6 @@ "xpack.infra.metadataEmbeddable.setFilterByValueTooltip": "Filtrer par valeur", "xpack.infra.metadataEmbeddable.setRemoveFilterTooltip": "Supprimer le filtre", "xpack.infra.metadataEmbeddable.value": "Valeur", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.percentSeriesLabel": "pour cent", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.sectionLabel": "Utilisation CPU", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.readsSeriesLabel": "lit", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.sectionLabel": "Octets d'E/S sur le disque", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.writesSeriesLabel": "écrit", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.readsSeriesLabel": "lit", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.sectionLabel": "Opérations d'E/S sur le disque", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.writesSeriesLabel": "écrit", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.rxSeriesLabel": "entrée", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.sectionLabel": "Trafic réseau", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.txSeriesLabel": "sortie", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsInSeriesLabel": "entrée", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsOutSeriesLabel": "sortie", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.sectionLabel": "Paquets réseau (moyenne)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.cpuUtilizationSeriesLabel": "Utilisation CPU", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsInLabel": "Paquets (entrée)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsOutLabel": "Paquets (sortie)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.sectionLabel": "Aperçu AWS", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.statusCheckFailedLabel": "La vérification du statut a échoué", "xpack.infra.metricDetailPage.containerMetricsLayout.cpuUsageSection.sectionLabel": "Utilisation CPU", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.readRateSeriesLabel": "lit", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.sectionLabel": "ES sur le disque (octets)", @@ -19039,32 +19020,6 @@ "xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.writeLabel": "écrit", "xpack.infra.metricDetailPage.ec2MetricsLayout.networkTrafficSection.sectionLabel": "Trafic réseau", "xpack.infra.metricDetailPage.ec2MetricsLayout.overviewSection.sectionLabel": "Aperçu EC2 AWS", - "xpack.infra.metricDetailPage.hostMetricsLayout.cpuUsageSection.sectionLabel": "Utilisation CPU", - "xpack.infra.metricDetailPage.hostMetricsLayout.layoutLabel": "Hôte", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fifteenMinuteSeriesLabel": "15 min", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fiveMinuteSeriesLabel": "5 min", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.oneMinuteSeriesLabel": "1 min", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.sectionLabel": "Charge", - "xpack.infra.metricDetailPage.hostMetricsLayout.memoryUsageSection.sectionLabel": "Utilisation mémoire", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkRxRateSeriesLabel": "entrée", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkTxRateSeriesLabel": "sortie", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.sectionLabel": "Trafic réseau", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.cpuUsageSeriesLabel": "Utilisation CPU", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.inboundRXSeriesLabel": "Entrant (RX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.loadSeriesLabel": "Charge (5 min)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.memoryCapacitySeriesLabel": "Utilisation mémoire", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.outboundTXSeriesLabel": "Sortant (TX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.sectionLabel": "Aperçu de l'hôte", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeCpuCapacitySection.sectionLabel": "Capacité CPU du nœud", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeDiskCapacitySection.sectionLabel": "Capacité du disque du nœud", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeMemoryCapacitySection.sectionLabel": "Capacité de mémoire du nœud", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodePodCapacitySection.sectionLabel": "Capacité de pod du nœud", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.cpuUsageSeriesLabel": "Capacité CPU", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.diskCapacitySeriesLabel": "Capacité du disque", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.loadSeriesLabel": "Charge (5 min)", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.memoryUsageSeriesLabel": "Capacité de mémoire", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.podCapacitySeriesLabel": "Capacité de pod", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.sectionLabel": "Aperçu Kubernetes", "xpack.infra.metricDetailPage.nginxMetricsLayout.activeConnectionsSection.sectionLabel": "Connexions actives", "xpack.infra.metricDetailPage.nginxMetricsLayout.hitsSection.sectionLabel": "Résultats", "xpack.infra.metricDetailPage.nginxMetricsLayout.requestRateSection.sectionLabel": "Taux de requêtes", @@ -39848,4 +39803,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "Présentation", "xpack.serverlessObservability.nav.getStarted": "Démarrer" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index db4e8cc67428..7f59456c6bd1 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -19010,25 +19010,6 @@ "xpack.infra.metadataEmbeddable.setFilterByValueTooltip": "値でフィルタリング", "xpack.infra.metadataEmbeddable.setRemoveFilterTooltip": "フィルターを削除", "xpack.infra.metadataEmbeddable.value": "値", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.percentSeriesLabel": "パーセント", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.sectionLabel": "CPU 使用状況", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.readsSeriesLabel": "読み取り", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.sectionLabel": "ディスク I/O バイト", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.writesSeriesLabel": "書き込み", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.readsSeriesLabel": "読み取り", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.sectionLabel": "ディスク I/O オペレーション", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.writesSeriesLabel": "書き込み", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.rxSeriesLabel": "in", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.sectionLabel": "ネットワークトラフィック", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.txSeriesLabel": "出", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsInSeriesLabel": "in", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsOutSeriesLabel": "出", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.sectionLabel": "ネットワークパケット(平均)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.cpuUtilizationSeriesLabel": "CPU 使用状況", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsInLabel": "パケット(受信)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsOutLabel": "パケット(送信)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.sectionLabel": "AWS概要", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.statusCheckFailedLabel": "ステータス確認失敗", "xpack.infra.metricDetailPage.containerMetricsLayout.cpuUsageSection.sectionLabel": "CPU使用状況", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.readRateSeriesLabel": "読み取り", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.sectionLabel": "ディスク IO(バイト)", @@ -19053,32 +19034,6 @@ "xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.writeLabel": "書き込み", "xpack.infra.metricDetailPage.ec2MetricsLayout.networkTrafficSection.sectionLabel": "ネットワークトラフィック", "xpack.infra.metricDetailPage.ec2MetricsLayout.overviewSection.sectionLabel": "Aws EC2概要", - "xpack.infra.metricDetailPage.hostMetricsLayout.cpuUsageSection.sectionLabel": "CPU使用状況", - "xpack.infra.metricDetailPage.hostMetricsLayout.layoutLabel": "ホスト", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fifteenMinuteSeriesLabel": "15m", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fiveMinuteSeriesLabel": "5m", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.oneMinuteSeriesLabel": "1m", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.sectionLabel": "読み込み", - "xpack.infra.metricDetailPage.hostMetricsLayout.memoryUsageSection.sectionLabel": "メモリー使用状況", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkRxRateSeriesLabel": "in", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkTxRateSeriesLabel": "出", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.sectionLabel": "ネットワークトラフィック", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.cpuUsageSeriesLabel": "CPU使用状況", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.inboundRXSeriesLabel": "受信(RX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.loadSeriesLabel": "読み込み(5m)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.memoryCapacitySeriesLabel": "メモリー使用状況", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.outboundTXSeriesLabel": "送信(TX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.sectionLabel": "ホスト概要", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeCpuCapacitySection.sectionLabel": "ノード CPU 処理能力", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeDiskCapacitySection.sectionLabel": "ノードディスク容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeMemoryCapacitySection.sectionLabel": "ノードメモリー容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodePodCapacitySection.sectionLabel": "ノードポッド容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.cpuUsageSeriesLabel": "CPU 処理能力", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.diskCapacitySeriesLabel": "ディスク容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.loadSeriesLabel": "読み込み(5m)", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.memoryUsageSeriesLabel": "メモリー容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.podCapacitySeriesLabel": "ポッド容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.sectionLabel": "Kubernetes概要", "xpack.infra.metricDetailPage.nginxMetricsLayout.activeConnectionsSection.sectionLabel": "アクティブな接続", "xpack.infra.metricDetailPage.nginxMetricsLayout.hitsSection.sectionLabel": "ヒット数", "xpack.infra.metricDetailPage.nginxMetricsLayout.requestRateSection.sectionLabel": "リクエストレート", @@ -39839,4 +39794,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "実地検証", "xpack.serverlessObservability.nav.getStarted": "使ってみる" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 68e8ae1196d6..8474d0289c23 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -19010,25 +19010,6 @@ "xpack.infra.metadataEmbeddable.setFilterByValueTooltip": "按值筛选", "xpack.infra.metadataEmbeddable.setRemoveFilterTooltip": "移除筛选", "xpack.infra.metadataEmbeddable.value": "值", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.percentSeriesLabel": "百分比", - "xpack.infra.metricDetailPage.awsMetricsLayout.cpuUtilSection.sectionLabel": "CPU 使用率", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.readsSeriesLabel": "读取数", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.sectionLabel": "磁盘 I/O 字节数", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioBytesSection.writesSeriesLabel": "写入数", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.readsSeriesLabel": "读取数", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.sectionLabel": "磁盘 I/O 操作数", - "xpack.infra.metricDetailPage.awsMetricsLayout.diskioOperationsSection.writesSeriesLabel": "写入数", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.rxSeriesLabel": "于", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.sectionLabel": "网络流量", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkBytesSection.txSeriesLabel": "传出", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsInSeriesLabel": "于", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.packetsOutSeriesLabel": "传出", - "xpack.infra.metricDetailPage.awsMetricsLayout.networkPacketsSection.sectionLabel": "网络数据包(平均值)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.cpuUtilizationSeriesLabel": "CPU 使用率", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsInLabel": "数据包(传入)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.networkPacketsOutLabel": "数据包(传出)", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.sectionLabel": "AWS 概览", - "xpack.infra.metricDetailPage.awsMetricsLayout.overviewSection.statusCheckFailedLabel": "状态检查失败", "xpack.infra.metricDetailPage.containerMetricsLayout.cpuUsageSection.sectionLabel": "CPU 使用率", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.readRateSeriesLabel": "读取数", "xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.sectionLabel": "磁盘 IO(字节)", @@ -19053,32 +19034,6 @@ "xpack.infra.metricDetailPage.ec2MetricsLayout.diskIOBytesSection.writeLabel": "写入数", "xpack.infra.metricDetailPage.ec2MetricsLayout.networkTrafficSection.sectionLabel": "网络流量", "xpack.infra.metricDetailPage.ec2MetricsLayout.overviewSection.sectionLabel": "Aws EC2 概览", - "xpack.infra.metricDetailPage.hostMetricsLayout.cpuUsageSection.sectionLabel": "CPU 使用率", - "xpack.infra.metricDetailPage.hostMetricsLayout.layoutLabel": "主机", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fifteenMinuteSeriesLabel": "15 分钟", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.fiveMinuteSeriesLabel": "5 分钟", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.oneMinuteSeriesLabel": "1 分钟", - "xpack.infra.metricDetailPage.hostMetricsLayout.loadSection.sectionLabel": "加载", - "xpack.infra.metricDetailPage.hostMetricsLayout.memoryUsageSection.sectionLabel": "内存利用率", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkRxRateSeriesLabel": "于", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.networkTxRateSeriesLabel": "传出", - "xpack.infra.metricDetailPage.hostMetricsLayout.networkTrafficSection.sectionLabel": "网络流量", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.cpuUsageSeriesLabel": "CPU 使用率", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.inboundRXSeriesLabel": "入站 (RX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.loadSeriesLabel": "负载(5 分钟)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.memoryCapacitySeriesLabel": "内存利用率", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.outboundTXSeriesLabel": "出站 (TX)", - "xpack.infra.metricDetailPage.hostMetricsLayout.overviewSection.sectionLabel": "主机概览", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeCpuCapacitySection.sectionLabel": "节点 CPU 容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeDiskCapacitySection.sectionLabel": "节点磁盘容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodeMemoryCapacitySection.sectionLabel": "节点内存容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.nodePodCapacitySection.sectionLabel": "节点 Pod 容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.cpuUsageSeriesLabel": "CPU 容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.diskCapacitySeriesLabel": "磁盘容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.loadSeriesLabel": "负载(5 分钟)", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.memoryUsageSeriesLabel": "内存容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.podCapacitySeriesLabel": "Pod 容量", - "xpack.infra.metricDetailPage.kubernetesMetricsLayout.overviewSection.sectionLabel": "Kubernetes 概览", "xpack.infra.metricDetailPage.nginxMetricsLayout.activeConnectionsSection.sectionLabel": "活动连接", "xpack.infra.metricDetailPage.nginxMetricsLayout.hitsSection.sectionLabel": "命中数", "xpack.infra.metricDetailPage.nginxMetricsLayout.requestRateSection.sectionLabel": "请求速率", @@ -39833,4 +39788,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "指导", "xpack.serverlessObservability.nav.getStarted": "开始使用" } -} +} \ No newline at end of file diff --git a/x-pack/test/api_integration/apis/metrics_ui/metrics.ts b/x-pack/test/api_integration/apis/metrics_ui/metrics.ts index 5e0cff513002..a1e4552df68f 100644 --- a/x-pack/test/api_integration/apis/metrics_ui/metrics.ts +++ b/x-pack/test/api_integration/apis/metrics_ui/metrics.ts @@ -15,7 +15,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; import { DATES } from './constants'; -const { min, max } = DATES['7.0.0'].hosts; +const { min, max } = DATES['8.0.0'].pods_only; interface NodeDetailsRequest { metrics: InventoryMetric[]; @@ -31,8 +31,8 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); describe('metrics', () => { - before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/7.0.0/hosts')); - after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/7.0.0/hosts')); + before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/8.0.0/pods_only')); + after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/8.0.0/pods_only')); const fetchNodeDetails = async ( body: NodeDetailsRequest @@ -48,14 +48,14 @@ export default function ({ getService }: FtrProviderContext) { it('should basically work', async () => { const data = fetchNodeDetails({ sourceId: 'default', - metrics: ['hostCpuUsage'], + metrics: ['podCpuUsage'], timerange: { to: max, from: min, interval: '>=1m', }, - nodeId: 'demo-stack-mysql-01', - nodeType: 'host', + nodeId: '7d6d7955-f853-42b1-8613-11f52d0d2725', + nodeType: 'pod', }); return data.then((resp) => { if (!resp) { @@ -63,28 +63,28 @@ export default function ({ getService }: FtrProviderContext) { } expect(resp.metrics.length).to.equal(1); const metric = first(resp.metrics) as any; - expect(metric).to.have.property('id', 'hostCpuUsage'); + expect(metric).to.have.property('id', 'podCpuUsage'); expect(metric).to.have.property('series'); const series = first(metric.series) as any; - expect(series).to.have.property('id', 'user'); + expect(series).to.have.property('id', 'cpu'); expect(series).to.have.property('data'); const datapoint = last(series.data) as any; - expect(datapoint).to.have.property('timestamp', 1547571780000); - expect(datapoint).to.have.property('value', 0.0015); + expect(datapoint).to.have.property('timestamp', 1642698890000); + expect(datapoint).to.have.property('value', 0.544); }); }); it('should support multiple metrics', async () => { const data = fetchNodeDetails({ sourceId: 'default', - metrics: ['hostCpuUsage', 'hostLoad'], + metrics: ['podCpuUsage', 'podMemoryUsage'], timerange: { to: max, from: min, interval: '>=1m', }, - nodeId: 'demo-stack-mysql-01', - nodeType: 'host', + nodeId: '7d6d7955-f853-42b1-8613-11f52d0d2725', + nodeType: 'pod', }); return data.then((resp) => { if (!resp) { @@ -95,28 +95,26 @@ export default function ({ getService }: FtrProviderContext) { }); }); - it('should return multiple values for hostSystemOverview metric', () => { + it('should return multiple values for podOverview metric', () => { const data = fetchNodeDetails({ sourceId: 'default', - metrics: ['hostSystemOverview'], + metrics: ['podOverview'], timerange: { to: max, from: min, interval: '>=1m', }, - nodeId: 'demo-stack-mysql-01', - nodeType: 'host', + nodeId: '7d6d7955-f853-42b1-8613-11f52d0d2725', + nodeType: 'pod', }); return data.then((resp) => { if (!resp) { return; } - const hostSystemOverviewMetric = resp.metrics.find( - (metric) => metric.id === 'hostSystemOverview' - ); + const podOverviewMetric = resp.metrics.find((metric) => metric.id === 'podOverview'); - expect(hostSystemOverviewMetric?.series.length).to.be.greaterThan(1); + expect(podOverviewMetric?.series.length).to.be.greaterThan(1); }); }); });