Skip to content

Commit

Permalink
[Infra] Remove container and host tsvb fields (#198134)
Browse files Browse the repository at this point in the history
Closes #197993
## Summary

This PR removes the old tsvb fields used for containers before we
changed to the asset details view. They were used for displaying charts
but now we use lens formulas so those are no longer needed

## Testing

This PR removes old no longer used code so the testing should be for
regressions
- Go to Infrastructure Inventory
- Select Docker Container from the `Show` drop-down
- Click on any container: 

![image](https://github.com/user-attachments/assets/20f66745-4cbd-4700-b2c5-c43ee753b2cb)

- The asset details flyout and full page view should load as before (the
same as for hosts)
- Repeat same steps for host (and k8s pod)
  • Loading branch information
jennypavlova authored Nov 5, 2024
1 parent ae2b382 commit d4e4f9b
Show file tree
Hide file tree
Showing 31 changed files with 6 additions and 1,830 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ export const getFilteredMetrics = (
.filter((data) => data && data.source === 'metrics')
.map((data) => data && data.name);
return requiredMetrics.filter((metric) => {
const metricModelCreator = metrics.tsvb[metric];
const metricModelCreator = metrics?.tsvb[metric] ?? null;

// We just need to get a dummy version of the model so we can filter
// using the `requires` attribute.
const metricModel = metricModelCreator(TIMESTAMP_FIELD, 'test', '>=1m');
return metricMetadata.some((m) => m && metricModel.requires.includes(m));
const metricModel = metricModelCreator
? metricModelCreator(TIMESTAMP_FIELD, 'test', '>=1m')
: { requires: [''] }; // when tsvb is not defined (host & container)
return metricMetadata.some((m) => m && metricModel?.requires?.includes(m));
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ import { cpu } from './snapshot/cpu';
import { memory } from './snapshot/memory';
import { rx } from './snapshot/rx';
import { tx } from './snapshot/tx';
import { containerCpuKernel } from './tsvb/container_cpu_kernel';
import { containerCpuUsage } from './tsvb/container_cpu_usage';
import { containerDiskIOOps } from './tsvb/container_diskio_ops';
import { containerDiskIOBytes } from './tsvb/container_disk_io_bytes';
import { containerK8sCpuUsage } from './tsvb/container_k8s_cpu_usage';
import { containerK8sMemoryUsage } from './tsvb/container_k8s_memory_usage';
import { containerK8sOverview } from './tsvb/container_k8s_overview';
import { containerMemory } from './tsvb/container_memory';
import { containerNetworkTraffic } from './tsvb/container_network_traffic';
import { containerOverview } from './tsvb/container_overview';
import type { ContainerFormulas } from './formulas';
import { ContainerCharts } from './charts';

Expand All @@ -30,18 +20,6 @@ export const containerSnapshotMetricTypes = Object.keys(containerSnapshotMetrics
>;

export const metrics: InventoryMetricsWithCharts<ContainerFormulas, ContainerCharts> = {
tsvb: {
containerOverview,
containerCpuUsage,
containerCpuKernel,
containerDiskIOOps,
containerDiskIOBytes,
containerNetworkTraffic,
containerMemory,
containerK8sCpuUsage,
containerK8sOverview,
containerK8sMemoryUsage,
},
snapshot: containerSnapshotMetrics,
getFormulas: async () => await import('./formulas').then(({ formulas }) => formulas),
getCharts: async () => await import('./charts').then(({ charts }) => charts),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d4e4f9b

Please sign in to comment.