From 7a06d6a116166ce4c7f762a7d79031b211b04bbf Mon Sep 17 00:00:00 2001 From: amlannandy Date: Tue, 24 Dec 2024 12:15:26 +0530 Subject: [PATCH] chore: fix reported bugs and issues --- .../src/api/infra/getHostAttributeKeys.ts | 4 +- .../FilterRenderers/Checkbox/Checkbox.tsx | 8 +- .../InfraMonitoringK8s/InfraMonitoringK8s.tsx | 35 - .../InfraMonitoringK8s/Pods/K8sPodLists.tsx | 3 + .../InfraMonitoringK8s/Pods/constants.ts | 1785 +++++++++++++++-- .../InfraMonitoringK8s/commonUtils.tsx | 78 + .../container/InfraMonitoringK8s/constants.ts | 33 +- .../container/InfraMonitoringK8s/utils.tsx | 251 +-- .../hooks/queryBuilder/useGetAggregateKeys.ts | 7 +- 9 files changed, 1853 insertions(+), 351 deletions(-) create mode 100644 frontend/src/container/InfraMonitoringK8s/commonUtils.tsx diff --git a/frontend/src/api/infra/getHostAttributeKeys.ts b/frontend/src/api/infra/getHostAttributeKeys.ts index 4ab03ea8eb..2cdaf14efc 100644 --- a/frontend/src/api/infra/getHostAttributeKeys.ts +++ b/frontend/src/api/infra/getHostAttributeKeys.ts @@ -2,6 +2,7 @@ import { ApiBaseInstance } from 'api'; import { ErrorResponseHandler } from 'api/ErrorResponseHandler'; import { AxiosError, AxiosResponse } from 'axios'; import { baseAutoCompleteIdKeysOrder } from 'constants/queryBuilder'; +import { K8sCategory } from 'container/InfraMonitoringK8s/constants'; import { createIdFromObjectFields } from 'lib/createIdFromObjectFields'; import { ErrorResponse, SuccessResponse } from 'types/api'; import { @@ -11,12 +12,13 @@ import { export const getHostAttributeKeys = async ( searchText = '', + entity: K8sCategory, ): Promise | ErrorResponse> => { try { const response: AxiosResponse<{ data: IQueryAutocompleteResponse; }> = await ApiBaseInstance.get( - `/hosts/attribute_keys?dataSource=metrics&searchText=${searchText}`, + `/${entity}/attribute_keys?dataSource=metrics&searchText=${searchText}`, ); const payload: BaseAutocompleteData[] = diff --git a/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx b/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx index 6cfc134844..8b48a55dde 100644 --- a/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx +++ b/frontend/src/components/QuickFilters/FilterRenderers/Checkbox/Checkbox.tsx @@ -8,9 +8,11 @@ import { Button, Checkbox, Input, Skeleton, Typography } from 'antd'; import cx from 'classnames'; import { IQuickFiltersConfig } from 'components/QuickFilters/QuickFilters'; import { OPERATORS } from 'constants/queryBuilder'; +import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig'; import { getOperatorValue } from 'container/QueryBuilder/filters/QueryBuilderSearch/utils'; import { useGetAggregateValues } from 'hooks/queryBuilder/useGetAggregateValues'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; +import useDebouncedFn from 'hooks/useDebouncedFunction'; import { cloneDeep, isArray, isEmpty, isEqual, isFunction } from 'lodash-es'; import { ChevronDown, ChevronRight } from 'lucide-react'; import { useMemo, useState } from 'react'; @@ -73,6 +75,10 @@ export default function CheckboxFilter(props: ICheckboxProps): JSX.Element { ); const currentAttributeKeys = attributeValues.slice(0, visibleItemsCount); + const setSearchTextDebounced = useDebouncedFn((...args) => { + setSearchText(args[0] as string); + }, DEBOUNCE_DELAY); + // derive the state of each filter key here in the renderer itself and keep it in sync with current query // also we need to keep a note of last focussed query. // eslint-disable-next-line sonarjs/cognitive-complexity @@ -450,7 +456,7 @@ export default function CheckboxFilter(props: ICheckboxProps): JSX.Element {
setSearchText(e.target.value)} + onChange={(e): void => setSearchTextDebounced(e.target.value)} disabled={isFilterDisabled} />
diff --git a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx index c0785a7e25..f255d238a0 100644 --- a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx +++ b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx @@ -72,8 +72,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Pods - - ({PodsQuickFiltersConfig.length})
), @@ -94,8 +92,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Nodes - - ({NodesQuickFiltersConfig.length})
), @@ -119,11 +115,6 @@ export default function InfraMonitoringK8s(): JSX.Element { className="k8s-quick-filters-category-label-icon" /> Namespace - - - {' '} - ({NamespaceQuickFiltersConfig.length}){' '} - ), @@ -144,8 +135,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Clusters - - ({ClustersQuickFiltersConfig.length})
), @@ -169,11 +158,6 @@ export default function InfraMonitoringK8s(): JSX.Element { className="k8s-quick-filters-category-label-icon" /> Containers - - - {' '} - ({ContainersQuickFiltersConfig.length}){' '} - ), @@ -194,8 +178,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Volumes - - ({VolumesQuickFiltersConfig.length})
), @@ -216,11 +198,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Deployments - - - {' '} - ({DeploymentsQuickFiltersConfig.length}){' '} -
), @@ -241,8 +218,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
Jobs - - ({JobsQuickFiltersConfig.length})
), @@ -263,11 +238,6 @@ export default function InfraMonitoringK8s(): JSX.Element {
DaemonSets - - - {' '} - ({DaemonSetsQuickFiltersConfig.length}){' '} -
), @@ -291,11 +261,6 @@ export default function InfraMonitoringK8s(): JSX.Element { className="k8s-quick-filters-category-label-icon" /> StatefulSets - - - {' '} - ({StatefulsetsQuickFiltersConfig.length}){' '} - ), diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx index 014febe397..c5df34297b 100644 --- a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx @@ -28,6 +28,7 @@ import { updateLocalStorage, } from 'utils/localStorageReadWrite'; +import { K8sCategory } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; import { @@ -100,6 +101,7 @@ function K8sPodsList({ queryKey: [currentQuery.builder.queryData[0].dataSource, 'noop'], }, true, + K8sCategory.PODS, ); useEffect(() => { @@ -419,6 +421,7 @@ function K8sPodsList({ pagination={false} scroll={{ x: true }} tableLayout="fixed" + showHeader={false} loading={{ spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData, indicator: } />, diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts index b472656471..a9f21696e4 100644 --- a/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts @@ -9,48 +9,1445 @@ import { v4 } from 'uuid'; export const podWidgetInfo = [ { - title: 'Pod CPU Usage', + title: 'CPU Usage (cores)', yAxisUnit: '', }, { - title: 'Pod CPU Request / Limit Utilization', + title: 'CPU Request, Limit Utilization', yAxisUnit: 'percent', }, { - title: 'Pod Memory Usage', + title: 'Memory Usage (bytes)', yAxisUnit: 'bytes', }, { - title: 'Pod Memory Request / Limit Utilization', + title: 'Memory Request, Limit Utilization', yAxisUnit: 'percent', }, { - title: 'Pod Memory By State', + title: 'Memory by State', yAxisUnit: 'bytes', }, { - title: 'Pod Memory Major Page Faults', + title: 'Memory Major Page Faults', yAxisUnit: '', }, { - title: 'Network Rate', - yAxisUnit: 'bytes', + title: 'CPU Usage by Container (cores)', + yAxisUnit: '', + }, + { + title: 'CPU Request, Limit Utilization by Container', + yAxisUnit: 'percent', }, { - title: 'Network Errors', + title: 'Memory Usage by Container (bytes)', yAxisUnit: 'bytes', }, { - title: 'Pod Filesystem', + title: 'Memory Request, Limit Utilization by Container', + yAxisUnit: 'percent', + }, + { + title: 'Network rate', + yAxisUnit: 'binBps', + }, + { + title: 'Network errors', + yAxisUnit: '', + }, + { + title: 'File system (bytes)', yAxisUnit: 'bytes', }, -]; - -export const getPodQueryPayload = ( - pod: K8sPodsData, - start: number, - end: number, -): GetQueryResultsProps[] => [ +]; + +export const getPodQueryPayload = ( + pod: K8sPodsData, + start: number, + end: number, +): GetQueryResultsProps[] => [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_utilization', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e812bfd9', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + { + id: '067b2dc4', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_utilization', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '37729a44', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + { + id: '379af416', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Max', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_utilization', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '481db9b1', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + { + id: '39ee0dbd', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Min', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '2ea54c80', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '755c8a9d', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '7243d538', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1e3d01ee', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Avg', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '3ec4e2b6', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '0c8b2662', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Max', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'abe996ed', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'e915da76', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Min', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: '3addc70a', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '32c15c03', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Max', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_cpu_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: 'da9de2a8', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '703fced1', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Min', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_usage', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e6ca88fe', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '5418405c', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_usage', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'cd9de239', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1ea5c602', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Max', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_usage', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '952e535a', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'd7632974', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Min', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '65969a40', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '5a822bec', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'bd3dcfd4', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '3362c603', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Avg', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '04f5aff6', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'ce88008b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Max', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '8718a7d7', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '53fc92fd', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Max', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_request_utilization', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: '990f8296', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '61dfa9f6', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Min', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_limit_utilization', + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: '4c78ab5c', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '508cdf26', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Min', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_rss--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_rss', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f66ff082', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '80528f79', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'RSS Memory', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_working_set--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_working_set', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '2cae58e7', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '780cc786', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Working Set Memory', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'B-A', + legend: 'Cache Memory', + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_major_page_faults--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_pod_memory_major_page_faults', + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '7ad40408', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '8b2a539b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'major page faults', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, { selectedTime: 'GLOBAL_TIME', graphType: PANEL_TYPES.TIME_SERIES, @@ -60,10 +1457,10 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + id: 'container_cpu_utilization--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_cpu_utilization', + key: 'container_cpu_utilization', type: 'Gauge', }, aggregateOperator: 'avg', @@ -73,7 +1470,7 @@ export const getPodQueryPayload = ( filters: { items: [ { - id: '441b62d7', + id: 'fdf017be', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -86,7 +1483,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '1bea5feb', + id: '4b4382be', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -105,15 +1502,15 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: '{{k8s_pod_name}}', + legend: '{{k8s_container_name}}', limit: null, orderBy: [], queryName: 'A', @@ -158,20 +1555,20 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + id: 'container_cpu_utilization--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_cpu_request_utilization', + key: 'container_cpu_utilization', type: 'Gauge', }, aggregateOperator: 'avg', dataSource: DataSource.METRICS, - disabled: false, + disabled: true, expression: 'A', filters: { items: [ { - id: '68b1bfca', + id: 'f0c71cba', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -184,7 +1581,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'a5a24a08', + id: '9301d7c0', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -203,15 +1600,15 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'Request util %', + legend: '', limit: null, orderBy: [], queryName: 'A', @@ -223,20 +1620,20 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + id: 'k8s_container_cpu_request--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_cpu_limit_utilization', + key: 'k8s_container_cpu_request', type: 'Gauge', }, - aggregateOperator: 'avg', + aggregateOperator: 'latest', dataSource: DataSource.METRICS, - disabled: false, + disabled: true, expression: 'B', filters: { items: [ { - id: 'eb378bcb', + id: '9b14868b', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -249,7 +1646,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'e6486804', + id: '92b99374', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -268,25 +1665,103 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'Limit util %', + legend: '', limit: null, orderBy: [], queryName: 'B', reduceTo: 'avg', - spaceAggregation: 'sum', + spaceAggregation: 'max', stepInterval: 60, - timeAggregation: 'avg', + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: 'k8s_container_cpu_limit', + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'C', + filters: { + items: [ + { + id: '1de8c8b9', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_namespace_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1c7de95d', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_pod_name', + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_container_name', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'Req % : {{k8s_container_name}} ', + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: 'Limit % : {{k8s_container_name}} ', + queryName: 'F2', }, ], - queryFormulas: [], }, clickhouse_sql: [ { @@ -321,10 +1796,10 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', + id: 'container_memory_usage--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_usage', + key: 'container_memory_usage', type: 'Gauge', }, aggregateOperator: 'avg', @@ -334,7 +1809,7 @@ export const getPodQueryPayload = ( filters: { items: [ { - id: 'e52eab92', + id: 'e8914a2d', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -347,7 +1822,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '3c27bb50', + id: '964fd905', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -366,15 +1841,15 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: '{{k8s_pod_name}}', + legend: 'usage :: {{k8s_container_name}}', limit: null, orderBy: [], queryName: 'A', @@ -383,56 +1858,23 @@ export const getPodQueryPayload = ( stepInterval: 60, timeAggregation: 'avg', }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + id: 'container_memory_working_set--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_request_utilization', + key: 'container_memory_working_set', type: 'Gauge', }, aggregateOperator: 'avg', dataSource: DataSource.METRICS, disabled: false, - expression: 'A', + expression: 'B', filters: { items: [ { - id: '4346996a', + id: 'a2f69b5d', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -445,7 +1887,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'db7f5bbe', + id: '76a586be', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -464,18 +1906,18 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'Request util %', + legend: 'working set :: {{k8s_container_name}}', limit: null, orderBy: [], - queryName: 'A', + queryName: 'B', reduceTo: 'avg', spaceAggregation: 'sum', stepInterval: 60, @@ -484,20 +1926,20 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + id: 'container_memory_rss--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_limit_utilization', + key: 'container_memory_rss', type: 'Gauge', }, aggregateOperator: 'avg', dataSource: DataSource.METRICS, disabled: false, - expression: 'B', + expression: 'C', filters: { items: [ { - id: '1703522e', + id: '95fc86d1', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -510,7 +1952,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '08b3feed', + id: '7c5f875b', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -529,18 +1971,18 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'Limit util %', + legend: 'rss :: {{k8s_container_name}}', limit: null, orderBy: [], - queryName: 'B', + queryName: 'C', reduceTo: 'avg', spaceAggregation: 'sum', stepInterval: 60, @@ -582,20 +2024,20 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_rss--float64--Gauge--true', + id: 'container_memory_usage--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_rss', + key: 'container_memory_usage', type: 'Gauge', }, aggregateOperator: 'avg', dataSource: DataSource.METRICS, - disabled: false, + disabled: true, expression: 'A', filters: { items: [ { - id: 'df8f1304', + id: 'c2d56c31', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -608,7 +2050,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'adc0cfcb', + id: '80216712', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -627,15 +2069,15 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'RSS Memory', + legend: '', limit: null, orderBy: [], queryName: 'A', @@ -647,20 +2089,20 @@ export const getPodQueryPayload = ( { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_working_set--float64--Gauge--true', + id: 'k8s_container_memory_request--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_working_set', + key: 'k8s_container_memory_request', type: 'Gauge', }, - aggregateOperator: 'avg', + aggregateOperator: 'latest', dataSource: DataSource.METRICS, - disabled: false, + disabled: true, expression: 'B', filters: { items: [ { - id: 'ea65b3da', + id: 'c04e7733', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -673,7 +2115,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'ad7d4c50', + id: '84b59a9f', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -692,80 +2134,40 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: 'Working Set Memory', + legend: '', limit: null, orderBy: [], queryName: 'B', reduceTo: 'avg', - spaceAggregation: 'avg', + spaceAggregation: 'max', stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'B-A', - legend: 'Cache Memory', - queryName: 'F1', + timeAggregation: 'latest', }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ { aggregateAttribute: { dataType: DataTypes.Float64, - id: 'k8s_pod_memory_major_page_faults--float64--Gauge--true', + id: 'k8s_container_memory_limit--float64--Gauge--true', isColumn: true, isJSON: false, - key: 'k8s_pod_memory_major_page_faults', + key: 'k8s_container_memory_limit', type: 'Gauge', }, - aggregateOperator: 'avg', + aggregateOperator: 'latest', dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', + disabled: true, + expression: 'C', filters: { items: [ { - id: '5e4ef12c', + id: 'd1549857', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -778,7 +2180,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '02dd75e9', + id: 'd649ad0c', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -797,25 +2199,38 @@ export const getPodQueryPayload = ( groupBy: [ { dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', + id: 'k8s_container_name--string--tag--false', isColumn: false, isJSON: false, - key: 'k8s_pod_name', + key: 'k8s_container_name', type: 'tag', }, ], having: [], - legend: '{{k8s_pod_name}}', + legend: '', limit: null, orderBy: [], - queryName: 'A', + queryName: 'C', reduceTo: 'avg', - spaceAggregation: 'sum', + spaceAggregation: 'max', stepInterval: 60, - timeAggregation: 'avg', + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'Req % : {{k8s_container_name}} ', + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: 'Limit % : {{k8s_container_name}} ', + queryName: 'F2', }, ], - queryFormulas: [], }, clickhouse_sql: [ { @@ -962,14 +2377,14 @@ export const getPodQueryPayload = ( key: 'k8s_pod_network_errors', type: 'Sum', }, - aggregateOperator: 'rate', + aggregateOperator: 'increase', dataSource: DataSource.METRICS, disabled: false, expression: 'A', filters: { items: [ { - id: '5a162ee7', + id: '200e722b', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -982,7 +2397,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '3409864c', + id: 'b54a3d78', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -1024,7 +2439,7 @@ export const getPodQueryPayload = ( reduceTo: 'avg', spaceAggregation: 'sum', stepInterval: 60, - timeAggregation: 'rate', + timeAggregation: 'increase', }, ], queryFormulas: [], @@ -1075,7 +2490,7 @@ export const getPodQueryPayload = ( filters: { items: [ { - id: '65ccba85', + id: '779f7a2e', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -1088,7 +2503,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: 'e8516314', + id: '1a97cb95', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -1131,7 +2546,7 @@ export const getPodQueryPayload = ( filters: { items: [ { - id: 'fb50c8e7', + id: 'dd756bfe', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -1144,7 +2559,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '6079fbd3', + id: 'ddfbd379', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', @@ -1187,7 +2602,7 @@ export const getPodQueryPayload = ( filters: { items: [ { - id: '095456d6', + id: 'a5ac4705', key: { dataType: DataTypes.String, id: 'k8s_namespace_name--string--tag--false', @@ -1200,7 +2615,7 @@ export const getPodQueryPayload = ( value: pod.meta.k8s_namespace_name, }, { - id: '60f28200', + id: '1963fc96', key: { dataType: DataTypes.String, id: 'k8s_pod_name--string--tag--false', diff --git a/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx new file mode 100644 index 0000000000..280892c1d4 --- /dev/null +++ b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx @@ -0,0 +1,78 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + +import { Color } from '@signozhq/design-tokens'; + +/** + * Converts size in bytes to a human-readable string with appropriate units + */ +export function formatBytes(bytes: number, decimals = 2): string { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return `${parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}`; +} + +/** + * Wrapper component that renders its children for valid values or renders '-' for invalid values (-1) + */ +export function ValidateColumnValueWrapper({ + children, + value, +}: { + children: React.ReactNode; + value: number; +}): JSX.Element { + if (value === -1) { + return
-
; + } + + return
{children}
; +} + +/** + * Returns stroke color for request utilization parameters according to current value + */ +export function getStrokeColorForRequestUtilization(value: number): string { + const percent = Number((value * 100).toFixed(1)); + // Orange + if (percent <= 50) { + return Color.BG_AMBER_500; + } + // Green + if (percent > 50 && percent <= 100) { + return Color.BG_FOREST_500; + } + // Regular Red + if (percent > 100 && percent <= 150) { + return Color.BG_SAKURA_500; + } + // Dark Red + return Color.BG_CHERRY_600; +} + +/** + * Returns stroke color for limit utilization parameters according to current value + */ +export function getStrokeColorForLimitUtilization(value: number): string { + const percent = Number((value * 100).toFixed(1)); + // Green + if (percent <= 60) { + return Color.BG_FOREST_500; + } + // Yellow + if (percent > 60 && percent <= 80) { + return Color.BG_AMBER_200; + } + // Orange + if (percent > 80 && percent <= 95) { + return Color.BG_AMBER_500; + } + // Red + return Color.BG_SAKURA_500; +} + +export const getProgressBarText = (percent: number): React.ReactNode => + `${percent}%`; diff --git a/frontend/src/container/InfraMonitoringK8s/constants.ts b/frontend/src/container/InfraMonitoringK8s/constants.ts index d3cfb467cf..6eaaba232d 100644 --- a/frontend/src/container/InfraMonitoringK8s/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/constants.ts @@ -5,6 +5,19 @@ import { import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { DataSource } from 'types/common/queryBuilder'; +export enum K8sCategory { + PODS = 'pods', + NODES = 'nodes', + NAMESPACES = 'namespaces', + CLUSTERS = 'clusters', + DEPLOYMENTS = 'deployments', + STATEFULSETS = 'statefulsets', + DAEMONSETS = 'daemonsets', + CONTAINERS = 'containers', + JOBS = 'jobs', + VOLUMES = 'volumes', +} + export const K8sCategories = { PODS: 'pods', NODES: 'nodes', @@ -70,7 +83,7 @@ export const PodsQuickFiltersConfig: IQuickFiltersConfig[] = [ type: FiltersType.CHECKBOX, title: 'Cluster', attributeKey: { - key: 'k8s.cluster.name', + key: 'k8s_cluster_name', dataType: DataTypes.String, type: 'resource', isColumn: false, @@ -85,7 +98,7 @@ export const PodsQuickFiltersConfig: IQuickFiltersConfig[] = [ type: FiltersType.CHECKBOX, title: 'Deployments', attributeKey: { - key: 'k8s_cluster_name', + key: 'k8s_deployment_name', dataType: DataTypes.String, type: 'resource', isColumn: false, @@ -121,6 +134,7 @@ export const PodsQuickFiltersConfig: IQuickFiltersConfig[] = [ isColumn: false, isJSON: false, }, + dataSource: DataSource.METRICS, defaultOpen: false, }, { @@ -138,18 +152,6 @@ export const PodsQuickFiltersConfig: IQuickFiltersConfig[] = [ dataSource: DataSource.METRICS, defaultOpen: false, }, - { - type: FiltersType.CHECKBOX, - title: 'Volumes', - attributeKey: { - key: 'k8s_volume_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - defaultOpen: false, - }, ]; export const NodesQuickFiltersConfig: IQuickFiltersConfig[] = [ @@ -286,3 +288,6 @@ export const JobsQuickFiltersConfig: IQuickFiltersConfig[] = [ defaultOpen: true, }, ]; + +export const INVALID_MEMORY_CPU_VALUE_MESSAGE = + 'Some pods do not have memory requests/limits.'; diff --git a/frontend/src/container/InfraMonitoringK8s/utils.tsx b/frontend/src/container/InfraMonitoringK8s/utils.tsx index 046b4fbdba..f16b4fcb00 100644 --- a/frontend/src/container/InfraMonitoringK8s/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/utils.tsx @@ -1,7 +1,7 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ /* eslint-disable sonarjs/cognitive-complexity */ import './InfraMonitoringK8s.styles.scss'; -import { Color } from '@signozhq/design-tokens'; import { Progress, Tag, Tooltip } from 'antd'; import { ColumnType } from 'antd/es/table'; import { @@ -11,6 +11,15 @@ import { import { Group } from 'lucide-react'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; +import { + formatBytes, + getProgressBarText, + getStrokeColorForLimitUtilization, + getStrokeColorForRequestUtilization, + ValidateColumnValueWrapper, +} from './commonUtils'; +import { INVALID_MEMORY_CPU_VALUE_MESSAGE } from './constants'; + export interface IPodColumn { label: string; value: string; @@ -27,44 +36,44 @@ export const defaultAddedColumns: IPodColumn[] = [ }, { label: 'CPU Request Utilization (% of limit)', - value: 'cpuRequestUtilization', - id: 'cpuRequestUtilization', + value: 'cpu_request', + id: 'cpu_request', canRemove: false, }, { label: 'CPU Limit Utilization (% of request)', - value: 'cpuLimitUtilization', - id: 'cpuLimitUtilization', + value: 'cpu_limit', + id: 'cpu_limit', canRemove: false, }, { label: 'CPU Utilization (cores)', - value: 'cpuUtilization', - id: 'cpuUtilization', + value: 'cpu', + id: 'cpu', canRemove: false, }, { label: 'Memory Request Utilization (% of limit)', - value: 'memoryRequestUtilization', - id: 'memoryRequestUtilization', + value: 'memory_request', + id: 'memory_request', canRemove: false, }, { label: 'Memory Limit Utilization (% of request)', - value: 'memoryLimitUtilization', - id: 'memoryLimitUtilization', + value: 'memory_limit', + id: 'memory_limit', canRemove: false, }, { label: 'Memory Utilization (bytes)', - value: 'memoryUtilization', - id: 'memoryUtilization', + value: 'memory', + id: 'memory', canRemove: false, }, { label: 'Container Restarts', - value: 'containerRestarts', - id: 'containerRestarts', + value: 'restarts', + id: 'restarts', canRemove: false, }, ]; @@ -94,13 +103,13 @@ export interface K8sPodsRowData { key: string; podName: React.ReactNode; podUID: string; - cpuRequestUtilization: React.ReactNode; - cpuLimitUtilization: React.ReactNode; - cpuUtilization: React.ReactNode; - memoryRequestUtilization: React.ReactNode; - memoryLimitUtilization: React.ReactNode; - memoryUtilization: React.ReactNode; - containerRestarts: number; + cpu_request: React.ReactNode; + cpu_limit: React.ReactNode; + cpu: React.ReactNode; + memory_request: React.ReactNode; + memory_limit: React.ReactNode; + memory: React.ReactNode; + restarts: number; groupedByMeta?: any; } @@ -152,11 +161,13 @@ const columnsConfig = [ { title: (
- CPU Req Util + + CPU Request Utilization (% of limit) +
), - dataIndex: 'cpuRequestUtilization', - key: 'cpuRequestUtilization', + dataIndex: 'cpu_request', + key: 'cpu_request', width: 150, sorter: true, align: 'left', @@ -164,13 +175,13 @@ const columnsConfig = [ { title: (
- - CPU Limit Util + + CPU Limit Utilization (% of request)
), - dataIndex: 'cpuLimitUtilization', - key: 'cpuLimitUtilization', + dataIndex: 'cpu_limit', + key: 'cpu_limit', width: 150, sorter: true, align: 'left', @@ -178,11 +189,13 @@ const columnsConfig = [ { title: (
- CPU Util (cores) + + CPU Utilization (cores) +
), - dataIndex: 'cpuUtilization', - key: 'cpuUtilization', + dataIndex: 'cpu', + key: 'cpu', width: 80, sorter: true, align: 'left', @@ -190,13 +203,13 @@ const columnsConfig = [ { title: (
- - Mem Req Util + + Memory Request Utilization (% of limit)
), - dataIndex: 'memoryRequestUtilization', - key: 'memoryRequestUtilization', + dataIndex: 'memory_request', + key: 'memory_request', width: 150, sorter: true, align: 'left', @@ -204,13 +217,13 @@ const columnsConfig = [ { title: (
- - Mem Limit Util + + Memory Limit Utilization (% of request)
), - dataIndex: 'memoryLimitUtilization', - key: 'memoryLimitUtilization', + dataIndex: 'memory_limit', + key: 'memory_limit', width: 150, sorter: true, align: 'left', @@ -218,11 +231,13 @@ const columnsConfig = [ { title: (
- Mem Util (bytes) + + Memory Utilization (bytes) +
), - dataIndex: 'memoryUtilization', - key: 'memoryUtilization', + dataIndex: 'memory', + key: 'memory', width: 100, ellipsis: true, sorter: true, @@ -234,8 +249,8 @@ const columnsConfig = [ Container Restarts ), - dataIndex: 'containerRestarts', - key: 'containerRestarts', + dataIndex: 'restarts', + key: 'restarts', width: 100, ellipsis: true, sorter: true, @@ -335,81 +350,91 @@ export const formatDataForTable = ( key: `${pod.podUID}-${index}`, podName: (
-
{pod.meta.k8s_pod_name || ''}
+ +
{pod.meta.k8s_pod_name || ''}
+
), podUID: pod.podUID || '', - cpuRequestUtilization: ( -
- { - const cpuPercent = Number((pod.podCPURequest * 100).toFixed(1)); - if (cpuPercent >= 90) return Color.BG_SAKURA_500; - if (cpuPercent >= 60) return Color.BG_AMBER_500; - return Color.BG_FOREST_500; - })()} - className="progress-bar" - /> -
+ cpu_request: ( + +
+ + getProgressBarText(Number((pod.podCPURequest * 100).toFixed(1))) + } + /> +
+
), - cpuLimitUtilization: ( -
- { - const cpuPercent = Number((pod.podCPULimit * 100).toFixed(1)); - if (cpuPercent >= 90) return Color.BG_SAKURA_500; - if (cpuPercent >= 60) return Color.BG_AMBER_500; - return Color.BG_FOREST_500; - })()} - className="progress-bar" - /> -
+ cpu_limit: ( + +
+ + getProgressBarText(Number((pod.podCPULimit * 100).toFixed(1))) + } + /> +
+
), - cpuUtilization: pod.podCPU, - memoryRequestUtilization: ( -
- { - const memoryPercent = Number((pod.podMemoryRequest * 100).toFixed(1)); - if (memoryPercent >= 90) return Color.BG_SAKURA_500; - if (memoryPercent >= 60) return Color.BG_AMBER_500; - return Color.BG_FOREST_500; - })()} - className="progress-bar" - /> -
+ cpu: ( + + {pod.podCPU} + ), - memoryLimitUtilization: ( -
- { - const memoryPercent = Number((pod.podMemoryLimit * 100).toFixed(1)); - if (memoryPercent >= 90) return Color.BG_SAKURA_500; - if (memoryPercent >= 60) return Color.BG_AMBER_500; - return Color.BG_FOREST_500; - })()} - className="progress-bar" - /> -
+ memory_request: ( + +
+ + getProgressBarText(Number((pod.podMemoryRequest * 100).toFixed(1))) + } + /> +
+
+ ), + memory_limit: ( + +
+ + getProgressBarText(Number((pod.podMemoryLimit * 100).toFixed(1))) + } + /> +
+
+ ), + memory: ( + + {formatBytes(pod.podMemory)} + ), - memoryUtilization: pod.podMemory, - containerRestarts: pod.restartCount, + restarts: pod.restartCount, namespace: pod.meta.k8s_namespace_name, node: pod.meta.k8s_node_name, cluster: pod.meta.k8s_job_name, diff --git a/frontend/src/hooks/queryBuilder/useGetAggregateKeys.ts b/frontend/src/hooks/queryBuilder/useGetAggregateKeys.ts index 91e4267f86..23e0f4af1a 100644 --- a/frontend/src/hooks/queryBuilder/useGetAggregateKeys.ts +++ b/frontend/src/hooks/queryBuilder/useGetAggregateKeys.ts @@ -1,6 +1,7 @@ import { getHostAttributeKeys } from 'api/infra/getHostAttributeKeys'; import { getAggregateKeys } from 'api/queryBuilder/getAttributeKeys'; import { QueryBuilderKeys } from 'constants/queryBuilder'; +import { K8sCategory } from 'container/InfraMonitoringK8s/constants'; import { useMemo } from 'react'; import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query'; import { ErrorResponse, SuccessResponse } from 'types/api'; @@ -13,6 +14,7 @@ type UseGetAttributeKeys = ( SuccessResponse | ErrorResponse >, isInfraMonitoring?: boolean, + infraMonitoringEntity?: K8sCategory, ) => UseQueryResult< SuccessResponse | ErrorResponse >; @@ -21,6 +23,7 @@ export const useGetAggregateKeys: UseGetAttributeKeys = ( requestData, options, isInfraMonitoring, + infraMonitoringEntity, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -36,8 +39,8 @@ export const useGetAggregateKeys: UseGetAttributeKeys = ( return useQuery | ErrorResponse>({ queryKey, queryFn: () => - isInfraMonitoring - ? getHostAttributeKeys(requestData.searchText) + isInfraMonitoring && infraMonitoringEntity + ? getHostAttributeKeys(requestData.searchText, infraMonitoringEntity) : getAggregateKeys(requestData), ...options, });