Skip to content

Commit

Permalink
[Infra UI] Cleanup host-specific Node Detail Page code (#166828)
Browse files Browse the repository at this point in the history
closes: #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>
  • Loading branch information
crespocarlos and kibanamachine authored Sep 28, 2023
1 parent 3be21c9 commit d79a383
Show file tree
Hide file tree
Showing 39 changed files with 107 additions and 2,560 deletions.
18 changes: 0 additions & 18 deletions x-pack/plugins/infra/common/inventory_models/host/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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'],
};
35 changes: 0 additions & 35 deletions x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d79a383

Please sign in to comment.