Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: implement deployments, clusters and namespaces in k8s infra monitoring (#6786)

Amlan Kumar Nandy403043e076bf
diff --git a/frontend/src/api/infraMonitoring/getInfraAttributeValues.ts b/frontend/src/api/infraMonitoring/getInfraAttributeValues.ts
index c1a9531b84..0e6b17ce11 100644
--- a/frontend/src/api/infraMonitoring/getInfraAttributeValues.ts
+++ b/frontend/src/api/infraMonitoring/getInfraAttributeValues.ts
@@ -1,4 +1,4 @@
-import { ApiBaseInstance } from 'api';
+import axios from 'api';
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
import { AxiosError } from 'axios';
import createQueryParams from 'lib/createQueryParams';
@@ -19,7 +19,7 @@ export const getInfraAttributesValues = async ({
SuccessResponse<IAttributeValuesResponse> | ErrorResponse
> => {
try {
- const response = await ApiBaseInstance.get(
+ const response = await axios.get(
`/hosts/attribute_values?${createQueryParams({
dataSource,
attributeKey,
diff --git a/frontend/src/api/infraMonitoring/getK8sClustersList.ts b/frontend/src/api/infraMonitoring/getK8sClustersList.ts
new file mode 100644
index 0000000000..2da1b214b3
--- /dev/null
+++ b/frontend/src/api/infraMonitoring/getK8sClustersList.ts
@@ -0,0 +1,64 @@
+import axios from 'api';
+import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
+import { AxiosError } from 'axios';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
+
+export interface K8sClustersListPayload {
+ filters: TagFilter;
+ groupBy?: BaseAutocompleteData[];
+ offset?: number;
+ limit?: number;
+ orderBy?: {
+ columnName: string;
+ order: 'asc' | 'desc';
+ };
+}
+
+export interface K8sClustersData {
+ clusterUID: string;
+ cpuUsage: number;
+ cpuAllocatable: number;
+ memoryUsage: number;
+ memoryAllocatable: number;
+ meta: {
+ k8s_cluster_name: string;
+ k8s_cluster_uid: string;
+ };
+}
+
+export interface K8sClustersListResponse {
+ status: string;
+ data: {
+ type: string;
+ records: K8sClustersData[];
+ groups: null;
+ total: number;
+ sentAnyHostMetricsData: boolean;
+ isSendingK8SAgentMetrics: boolean;
+ };
+}
+
+export const getK8sClustersList = async (
+ props: K8sClustersListPayload,
+ signal?: AbortSignal,
+ headers?: Record<string, string>,
+): Promise<SuccessResponse<K8sClustersListResponse> | ErrorResponse> => {
+ try {
+ const response = await axios.post('/clusters/list', props, {
+ signal,
+ headers,
+ });
+
+ return {
+ statusCode: 200,
+ error: null,
+ message: 'Success',
+ payload: response.data,
+ params: props,
+ };
+ } catch (error) {
+ return ErrorResponseHandler(error as AxiosError);
+ }
+};
diff --git a/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts
new file mode 100644
index 0000000000..b991ce22e7
--- /dev/null
+++ b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts
@@ -0,0 +1,70 @@
+import axios from 'api';
+import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
+import { AxiosError } from 'axios';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
+
+export interface K8sDeploymentsListPayload {
+ filters: TagFilter;
+ groupBy?: BaseAutocompleteData[];
+ offset?: number;
+ limit?: number;
+ orderBy?: {
+ columnName: string;
+ order: 'asc' | 'desc';
+ };
+}
+
+export interface K8sDeploymentsData {
+ deploymentName: string;
+ cpuUsage: number;
+ memoryUsage: number;
+ desiredPods: number;
+ availablePods: number;
+ cpuRequest: number;
+ memoryRequest: number;
+ cpuLimit: number;
+ memoryLimit: number;
+ restarts: number;
+ meta: {
+ k8s_cluster_name: string;
+ k8s_deployment_name: string;
+ k8s_namespace_name: string;
+ };
+}
+
+export interface K8sDeploymentsListResponse {
+ status: string;
+ data: {
+ type: string;
+ records: K8sDeploymentsData[];
+ groups: null;
+ total: number;
+ sentAnyHostMetricsData: boolean;
+ isSendingK8SAgentMetrics: boolean;
+ };
+}
+
+export const getK8sDeploymentsList = async (
+ props: K8sDeploymentsListPayload,
+ signal?: AbortSignal,
+ headers?: Record<string, string>,
+): Promise<SuccessResponse<K8sDeploymentsListResponse> | ErrorResponse> => {
+ try {
+ const response = await axios.post('/deployments/list', props, {
+ signal,
+ headers,
+ });
+
+ return {
+ statusCode: 200,
+ error: null,
+ message: 'Success',
+ payload: response.data,
+ params: props,
+ };
+ } catch (error) {
+ return ErrorResponseHandler(error as AxiosError);
+ }
+};
diff --git a/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts
new file mode 100644
index 0000000000..bba2249f4e
--- /dev/null
+++ b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts
@@ -0,0 +1,62 @@
+import axios from 'api';
+import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
+import { AxiosError } from 'axios';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
+
+export interface K8sNamespacesListPayload {
+ filters: TagFilter;
+ groupBy?: BaseAutocompleteData[];
+ offset?: number;
+ limit?: number;
+ orderBy?: {
+ columnName: string;
+ order: 'asc' | 'desc';
+ };
+}
+
+export interface K8sNamespacesData {
+ namespaceName: string;
+ cpuUsage: number;
+ memoryUsage: number;
+ meta: {
+ k8s_cluster_name: string;
+ k8s_namespace_name: string;
+ };
+}
+
+export interface K8sNamespacesListResponse {
+ status: string;
+ data: {
+ type: string;
+ records: K8sNamespacesData[];
+ groups: null;
+ total: number;
+ sentAnyHostMetricsData: boolean;
+ isSendingK8SAgentMetrics: boolean;
+ };
+}
+
+export const getK8sNamespacesList = async (
+ props: K8sNamespacesListPayload,
+ signal?: AbortSignal,
+ headers?: Record<string, string>,
+): Promise<SuccessResponse<K8sNamespacesListResponse> | ErrorResponse> => {
+ try {
+ const response = await axios.post('/namespaces/list', props, {
+ signal,
+ headers,
+ });
+
+ return {
+ statusCode: 200,
+ error: null,
+ message: 'Success',
+ payload: response.data,
+ params: props,
+ };
+ } catch (error) {
+ return ErrorResponseHandler(error as AxiosError);
+ }
+};
diff --git a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx
index 3b8fc88a35..bb5c17a506 100644
--- a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx
+++ b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx
@@ -127,6 +127,18 @@ function HostMetricsLogs({
data={logToRender}
linesPerRow={5}
fontSize={FontSize.MEDIUM}
+ selectedFields={[
+ {
+ dataType: 'string',
+ type: '',
+ name: 'body',
+ },
+ {
+ dataType: 'string',
+ type: '',
+ name: 'timestamp',
+ },
+ ]}
/>
),
[],
diff --git a/frontend/src/constants/reactQueryKeys.ts b/frontend/src/constants/reactQueryKeys.ts
index 5520872201..30da4e1362 100644
--- a/frontend/src/constants/reactQueryKeys.ts
+++ b/frontend/src/constants/reactQueryKeys.ts
@@ -22,4 +22,8 @@ export const REACT_QUERY_KEY = {
UPDATE_ALERT_RULE: 'UPDATE_ALERT_RULE',
GET_ACTIVE_LICENSE_V3: 'GET_ACTIVE_LICENSE_V3',
GET_POD_LIST: 'GET_POD_LIST',
+ GET_NODE_LIST: 'GET_NODE_LIST',
+ GET_DEPLOYMENT_LIST: 'GET_DEPLOYMENT_LIST',
+ GET_CLUSTER_LIST: 'GET_CLUSTER_LIST',
+ GET_NAMESPACE_LIST: 'GET_NAMESPACE_LIST',
};
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.interfaces.ts b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.interfaces.ts
new file mode 100644
index 0000000000..8126d50fba
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.interfaces.ts
@@ -0,0 +1,7 @@
+import { K8sClustersData } from 'api/infraMonitoring/getK8sClustersList';
+
+export type ClusterDetailsProps = {
+ cluster: K8sClustersData | null;
+ isModalTimeSelection: boolean;
+ onClose: () => void;
+};
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx
new file mode 100644
index 0000000000..17080f7d8e
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/ClusterDetails.tsx
@@ -0,0 +1,558 @@
+/* eslint-disable sonarjs/no-identical-functions */
+import '../../EntityDetailsUtils/entityDetails.styles.scss';
+
+import { Color, Spacing } from '@signozhq/design-tokens';
+import { Button, Divider, Drawer, Radio, Tooltip, Typography } from 'antd';
+import { RadioChangeEvent } from 'antd/lib';
+import logEvent from 'api/common/logEvent';
+import { K8sClustersData } from 'api/infraMonitoring/getK8sClustersList';
+import { VIEW_TYPES, VIEWS } from 'components/HostMetricsDetail/constants';
+import { QueryParams } from 'constants/query';
+import {
+ initialQueryBuilderFormValuesMap,
+ initialQueryState,
+} from 'constants/queryBuilder';
+import ROUTES from 'constants/routes';
+import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
+import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/utils';
+import {
+ CustomTimeType,
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/config';
+import { useIsDarkMode } from 'hooks/useDarkMode';
+import useUrlQuery from 'hooks/useUrlQuery';
+import GetMinMax from 'lib/getMinMax';
+import {
+ BarChart2,
+ ChevronsLeftRight,
+ Compass,
+ DraftingCompass,
+ ScrollText,
+ X,
+} from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import {
+ IBuilderQuery,
+ TagFilterItem,
+} from 'types/api/queryBuilder/queryBuilderData';
+import {
+ LogsAggregatorOperator,
+ TracesAggregatorOperator,
+} from 'types/common/queryBuilder';
+import { GlobalReducer } from 'types/reducer/globalTime';
+import { v4 as uuidv4 } from 'uuid';
+
+import ClusterEvents from '../../EntityDetailsUtils/EntityEvents';
+import ClusterLogs from '../../EntityDetailsUtils/EntityLogs';
+import ClusterMetrics from '../../EntityDetailsUtils/EntityMetrics';
+import ClusterTraces from '../../EntityDetailsUtils/EntityTraces';
+import { ClusterDetailsProps } from './ClusterDetails.interfaces';
+import { clusterWidgetInfo, getClusterMetricsQueryPayload } from './constants';
+
+function ClusterDetails({
+ cluster,
+ onClose,
+ isModalTimeSelection,
+}: ClusterDetailsProps): JSX.Element {
+ const { maxTime, minTime, selectedTime } = useSelector<
+ AppState,
+ GlobalReducer
+ >((state) => state.globalTime);
+
+ const startMs = useMemo(() => Math.floor(Number(minTime) / 1000000000), [
+ minTime,
+ ]);
+ const endMs = useMemo(() => Math.floor(Number(maxTime) / 1000000000), [
+ maxTime,
+ ]);
+
+ const urlQuery = useUrlQuery();
+
+ const [modalTimeRange, setModalTimeRange] = useState(() => ({
+ startTime: startMs,
+ endTime: endMs,
+ }));
+
+ const [selectedInterval, setSelectedInterval] = useState<Time>(
+ selectedTime as Time,
+ );
+
+ const [selectedView, setSelectedView] = useState<VIEWS>(VIEWS.METRICS);
+ const isDarkMode = useIsDarkMode();
+
+ const initialFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_CLUSTER_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s_cluster_name--string--resource--false',
+ },
+ op: '=',
+ value: cluster?.meta.k8s_cluster_name || '',
+ },
+ ],
+ }),
+ [cluster?.meta.k8s_cluster_name],
+ );
+
+ const initialEventsFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_KIND,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.kind--string--resource--false',
+ },
+ op: '=',
+ value: 'Cluster',
+ },
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.name--string--resource--false',
+ },
+ op: '=',
+ value: cluster?.meta.k8s_cluster_name || '',
+ },
+ ],
+ }),
+ [cluster?.meta.k8s_cluster_name],
+ );
+
+ const [logFilters, setLogFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [tracesFilters, setTracesFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [eventsFilters, setEventsFilters] = useState<IBuilderQuery['filters']>(
+ initialEventsFilters,
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: Clusters list details page visited', {
+ cluster: cluster?.clusterUID,
+ });
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ useEffect(() => {
+ setLogFilters(initialFilters);
+ setTracesFilters(initialFilters);
+ setEventsFilters(initialEventsFilters);
+ }, [initialFilters, initialEventsFilters]);
+
+ useEffect(() => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ }, [selectedTime, minTime, maxTime]);
+
+ const handleTabChange = (e: RadioChangeEvent): void => {
+ setSelectedView(e.target.value);
+ };
+
+ const handleTimeChange = useCallback(
+ (interval: Time | CustomTimeType, dateTimeRange?: [number, number]): void => {
+ setSelectedInterval(interval as Time);
+
+ if (interval === 'custom' && dateTimeRange) {
+ setModalTimeRange({
+ startTime: Math.floor(dateTimeRange[0] / 1000),
+ endTime: Math.floor(dateTimeRange[1] / 1000),
+ });
+ } else {
+ const { maxTime, minTime } = GetMinMax(interval);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+
+ logEvent('Infra Monitoring: Clusters list details time updated', {
+ cluster: cluster?.clusterUID,
+ interval,
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeLogFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setLogFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_CLUSTER_NAME].includes(item.key?.key ?? ''),
+ );
+ const paginationFilter = value.items.find((item) => item.key?.key === 'id');
+ const newFilters = value.items.filter(
+ (item) =>
+ item.key?.key !== 'id' && item.key?.key !== QUERY_KEYS.K8S_CLUSTER_NAME,
+ );
+
+ logEvent('Infra Monitoring: Clusters list details logs filters applied', {
+ cluster: cluster?.clusterUID,
+ });
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ ...primaryFilters,
+ ...newFilters,
+ ...(paginationFilter ? [paginationFilter] : []),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeTracesFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setTracesFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_CLUSTER_NAME].includes(item.key?.key ?? ''),
+ );
+
+ logEvent('Infra Monitoring: Clusters list details traces filters applied', {
+ cluster: cluster?.clusterUID,
+ });
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ ...primaryFilters,
+ ...value.items.filter(
+ (item) => item.key?.key !== QUERY_KEYS.K8S_CLUSTER_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeEventsFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setEventsFilters((prevFilters) => {
+ const clusterKindFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_KIND,
+ );
+ const clusterNameFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_NAME,
+ );
+
+ logEvent('Infra Monitoring: Clusters list details events filters applied', {
+ cluster: cluster?.clusterUID,
+ });
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ clusterKindFilter,
+ clusterNameFilter,
+ ...value.items.filter(
+ (item) =>
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_KIND &&
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleExplorePagesRedirect = (): void => {
+ if (selectedInterval !== 'custom') {
+ urlQuery.set(QueryParams.relativeTime, selectedInterval);
+ } else {
+ urlQuery.delete(QueryParams.relativeTime);
+ urlQuery.set(QueryParams.startTime, modalTimeRange.startTime.toString());
+ urlQuery.set(QueryParams.endTime, modalTimeRange.endTime.toString());
+ }
+
+ logEvent('Infra Monitoring: Clusters list details explore clicked', {
+ cluster: cluster?.clusterUID,
+ view: selectedView,
+ });
+
+ if (selectedView === VIEW_TYPES.LOGS) {
+ const filtersWithoutPagination = {
+ ...logFilters,
+ items: logFilters.items.filter((item) => item.key?.key !== 'id'),
+ };
+
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.logs,
+ aggregateOperator: LogsAggregatorOperator.NOOP,
+ filters: filtersWithoutPagination,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.LOGS_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ } else if (selectedView === VIEW_TYPES.TRACES) {
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.traces,
+ aggregateOperator: TracesAggregatorOperator.NOOP,
+ filters: tracesFilters,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.TRACES_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ }
+ };
+
+ const handleClose = (): void => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ setSelectedView(VIEW_TYPES.METRICS);
+ onClose();
+ };
+
+ return (
+ <Drawer
+ width="70%"
+ title={
+ <>
+ <Divider type="vertical" />
+ <Typography.Text className="title">
+ {cluster?.meta.k8s_cluster_name}
+ </Typography.Text>
+ </>
+ }
+ placement="right"
+ onClose={handleClose}
+ open={!!cluster}
+ style={{
+ overscrollBehavior: 'contain',
+ background: isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100,
+ }}
+ className="entity-detail-drawer"
+ destroyOnClose
+ closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
+ >
+ {cluster && (
+ <>
+ <div className="entity-detail-drawer__entity">
+ <div className="entity-details-grid">
+ <div className="labels-row">
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Cluster Name
+ </Typography.Text>
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Cluster Name
+ </Typography.Text>
+ </div>
+ <div className="values-row">
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title={cluster.meta.k8s_cluster_name}>
+ {cluster.meta.k8s_cluster_name}
+ </Tooltip>
+ </Typography.Text>
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title="Cluster name">{cluster.meta.k8s_cluster_name}</Tooltip>
+ </Typography.Text>
+ </div>
+ </div>
+ </div>
+
+ <div className="views-tabs-container">
+ <Radio.Group
+ className="views-tabs"
+ onChange={handleTabChange}
+ value={selectedView}
+ >
+ <Radio.Button
+ className={
+ // eslint-disable-next-line sonarjs/no-duplicate-string
+ selectedView === VIEW_TYPES.METRICS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.METRICS}
+ >
+ <div className="view-title">
+ <BarChart2 size={14} />
+ Metrics
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.LOGS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.LOGS}
+ >
+ <div className="view-title">
+ <ScrollText size={14} />
+ Logs
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.TRACES ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.TRACES}
+ >
+ <div className="view-title">
+ <DraftingCompass size={14} />
+ Traces
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.EVENTS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.EVENTS}
+ >
+ <div className="view-title">
+ <ChevronsLeftRight size={14} />
+ Events
+ </div>
+ </Radio.Button>
+ </Radio.Group>
+
+ {(selectedView === VIEW_TYPES.LOGS ||
+ selectedView === VIEW_TYPES.TRACES) && (
+ <Button
+ icon={<Compass size={18} />}
+ className="compass-button"
+ onClick={handleExplorePagesRedirect}
+ />
+ )}
+ </div>
+ {selectedView === VIEW_TYPES.METRICS && (
+ <ClusterMetrics<K8sClustersData>
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ entity={cluster}
+ entityWidgetInfo={clusterWidgetInfo}
+ getEntityQueryPayload={getClusterMetricsQueryPayload}
+ category={K8sCategory.CLUSTERS}
+ queryKey="clusterMetrics"
+ />
+ )}
+ {selectedView === VIEW_TYPES.LOGS && (
+ <ClusterLogs
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeLogFilters={handleChangeLogFilters}
+ logFilters={logFilters}
+ selectedInterval={selectedInterval}
+ queryKey="clusterLogs"
+ category={K8sCategory.CLUSTERS}
+ queryKeyFilters={[QUERY_KEYS.K8S_CLUSTER_NAME]}
+ />
+ )}
+ {selectedView === VIEW_TYPES.TRACES && (
+ <ClusterTraces
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeTracesFilters={handleChangeTracesFilters}
+ tracesFilters={tracesFilters}
+ selectedInterval={selectedInterval}
+ queryKey="clusterTraces"
+ />
+ )}
+ {selectedView === VIEW_TYPES.EVENTS && (
+ <ClusterEvents
+ timeRange={modalTimeRange}
+ handleChangeEventFilters={handleChangeEventsFilters}
+ filters={eventsFilters}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ category={K8sCategory.CLUSTERS}
+ queryKey="clusterEvents"
+ />
+ )}
+ </>
+ )}
+ </Drawer>
+ );
+}
+
+export default ClusterDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts
new file mode 100644
index 0000000000..9d60aca7a4
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts
@@ -0,0 +1,1530 @@
+/* eslint-disable sonarjs/no-duplicate-string */
+import { K8sClustersData } from 'api/infraMonitoring/getK8sClustersList';
+import { PANEL_TYPES } from 'constants/queryBuilder';
+import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { EQueryType } from 'types/common/dashboard';
+import { DataSource } from 'types/common/queryBuilder';
+import { v4 } from 'uuid';
+
+export const clusterWidgetInfo = [
+ {
+ title: 'CPU Usage, allocatable',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Memory Usage, allocatable',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Ready Nodes',
+ yAxisUnit: '',
+ },
+ {
+ title: 'NotReady Nodes',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Deployments available and desired',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Statefulset pods',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Daemonset nodes',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Jobs',
+ yAxisUnit: '',
+ },
+];
+
+export const getClusterMetricsQueryPayload = (
+ cluster: K8sClustersData,
+ 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: '0224c582',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (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: 'min',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'a0e11f0c',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (min)',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'min',
+ },
+ {
+ 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: 'C',
+ filters: {
+ items: [
+ {
+ id: 'c775629c',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (max)',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_cpu',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: '31f6c43a',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ 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,
+ 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: '61a3c55e',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (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: 'min',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '834a887f',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (min)',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'min',
+ },
+ {
+ 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: 'C',
+ filters: {
+ items: [
+ {
+ id: '9b002160',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage (max)',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_memory--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_memory',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: '02a9a67e',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_condition_ready--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_condition_ready',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'd7779183',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ ],
+ having: [
+ {
+ columnName: 'MAX(k8s_node_condition_ready)',
+ op: '=',
+ value: 1,
+ },
+ ],
+ legend: '{{k8s_node_name}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ ],
+ 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_node_condition_ready--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_condition_ready',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'd7779183',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ ],
+ having: [
+ {
+ columnName: 'MAX(k8s_node_condition_ready)',
+ op: '=',
+ value: 0,
+ },
+ ],
+ legend: '{{k8s_node_name}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ ],
+ 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.TABLE,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_deployment_available--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_deployment_available',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'a7da59c7',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'available',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_deployment_desired--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_deployment_desired',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '55110885',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'desired',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'last',
+ 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: true,
+ start,
+ end,
+ },
+ {
+ selectedTime: 'GLOBAL_TIME',
+ graphType: PANEL_TYPES.TABLE,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_statefulset_current_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_statefulset_current_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '3c57b4d1',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_statefulset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_statefulset_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'current',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_statefulset_desired_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_statefulset_desired_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '0f49fe64',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_statefulset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_statefulset_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'desired',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_statefulset_ready_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_statefulset_ready_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '0bebf625',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_statefulset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_statefulset_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'ready',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_statefulset_updated_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_statefulset_updated_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: '1ddacbbe',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_statefulset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_statefulset_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'updated',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ ],
+ queryFormulas: [],
+ },
+ clickhouse_sql: [
+ {
+ disabled: false,
+ legend: '',
+ name: 'A',
+ query: '',
+ },
+ ],
+ id: v4(),
+ promql: [
+ {
+ disabled: false,
+ legend: '',
+ name: 'A',
+ query: '',
+ },
+ ],
+ queryType: EQueryType.QUERY_BUILDER,
+ },
+ variables: {},
+ formatForWeb: true,
+ start,
+ end,
+ },
+ {
+ selectedTime: 'GLOBAL_TIME',
+ graphType: PANEL_TYPES.TABLE,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_daemonset_current_scheduled_nodes--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_daemonset_current_scheduled_nodes',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'e0bea554',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'current_nodes',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'last',
+ spaceAggregation: 'avg',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_daemonset_desired_scheduled_nodes--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_daemonset_desired_scheduled_nodes',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '741052f7',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'desired_nodes',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'last',
+ spaceAggregation: 'avg',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_daemonset_ready_nodes--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_daemonset_ready_nodes',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'f23759f2',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'ready_nodes',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'last',
+ spaceAggregation: 'avg',
+ 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: true,
+ start,
+ end,
+ },
+ {
+ selectedTime: 'GLOBAL_TIME',
+ graphType: PANEL_TYPES.TABLE,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_job_active_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_job_active_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'fd485d85',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_job_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_job_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'running',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_job_successful_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_job_successful_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'fc1beb81',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_job_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_job_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'successful',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_job_failed_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_job_failed_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '97773348',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_job_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_job_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'failed',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_job_desired_successful_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_job_desired_successful_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: '5911618b',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_cluster_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_cluster_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: cluster.meta.k8s_cluster_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_job_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_job_name',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'desired successful',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ reduceTo: 'last',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ ],
+ queryFormulas: [],
+ },
+ clickhouse_sql: [
+ {
+ disabled: false,
+ legend: '',
+ name: 'A',
+ query: '',
+ },
+ ],
+ id: v4(),
+ promql: [
+ {
+ disabled: false,
+ legend: '',
+ name: 'A',
+ query: '',
+ },
+ ],
+ queryType: EQueryType.QUERY_BUILDER,
+ },
+ variables: {},
+ formatForWeb: true,
+ start,
+ end,
+ },
+];
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/index.ts b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/index.ts
new file mode 100644
index 0000000000..a183c3be4f
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/index.ts
@@ -0,0 +1,3 @@
+import ClusterDetails from './ClusterDetails';
+
+export default ClusterDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.styles.scss b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.styles.scss
new file mode 100644
index 0000000000..a7c5686eb0
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.styles.scss
@@ -0,0 +1,17 @@
+.infra-monitoring-container {
+ .clusters-list-table {
+ .expanded-table-container {
+ padding-left: 40px;
+ }
+
+ .ant-table-cell {
+ min-width: 223px !important;
+ max-width: 223px !important;
+ }
+
+ .ant-table-row-expand-icon-cell {
+ min-width: 30px !important;
+ max-width: 30px !important;
+ }
+ }
+}
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx
new file mode 100644
index 0000000000..da29494f45
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx
@@ -0,0 +1,511 @@
+/* eslint-disable no-restricted-syntax */
+/* eslint-disable @typescript-eslint/explicit-function-return-type */
+import '../InfraMonitoringK8s.styles.scss';
+import './K8sClustersList.styles.scss';
+
+import { LoadingOutlined } from '@ant-design/icons';
+import {
+ Button,
+ Spin,
+ Table,
+ TablePaginationConfig,
+ TableProps,
+ Typography,
+} from 'antd';
+import { ColumnType, SorterResult } from 'antd/es/table/interface';
+import logEvent from 'api/common/logEvent';
+import { K8sClustersListPayload } from 'api/infraMonitoring/getK8sClustersList';
+import { useGetK8sClustersList } from 'hooks/infraMonitoring/useGetK8sClustersList';
+import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
+import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
+import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
+import { ChevronDown, ChevronRight } from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { GlobalReducer } from 'types/reducer/globalTime';
+
+import {
+ K8sCategory,
+ K8sEntityToAggregateAttributeMapping,
+} from '../constants';
+import K8sHeader from '../K8sHeader';
+import LoadingContainer from '../LoadingContainer';
+import ClusterDetails from './ClusterDetails';
+import {
+ defaultAddedColumns,
+ formatDataForTable,
+ getK8sClustersListColumns,
+ getK8sClustersListQuery,
+ K8sClustersRowData,
+} from './utils';
+
+// eslint-disable-next-line sonarjs/cognitive-complexity
+function K8sClustersList({
+ isFiltersVisible,
+ handleFilterVisibilityChange,
+ quickFiltersLastUpdated,
+}: {
+ isFiltersVisible: boolean;
+ handleFilterVisibilityChange: () => void;
+ quickFiltersLastUpdated: number;
+}): JSX.Element {
+ const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
+ (state) => state.globalTime,
+ );
+
+ const [currentPage, setCurrentPage] = useState(1);
+
+ const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
+
+ const [orderBy, setOrderBy] = useState<{
+ columnName: string;
+ order: 'asc' | 'desc';
+ } | null>({ columnName: 'cpu', order: 'desc' });
+
+ const [selectedClusterName, setselectedClusterName] = useState<string | null>(
+ null,
+ );
+
+ const pageSize = 10;
+
+ const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>([]);
+
+ const [
+ selectedRowData,
+ setSelectedRowData,
+ ] = useState<K8sClustersRowData | null>(null);
+
+ const [groupByOptions, setGroupByOptions] = useState<
+ { value: string; label: string }[]
+ >([]);
+
+ const { currentQuery } = useQueryBuilder();
+
+ const queryFilters = useMemo(
+ () =>
+ currentQuery?.builder?.queryData[0]?.filters || {
+ items: [],
+ op: 'and',
+ },
+ [currentQuery?.builder?.queryData],
+ );
+
+ // Reset pagination every time quick filters are changed
+ useEffect(() => {
+ setCurrentPage(1);
+ }, [quickFiltersLastUpdated]);
+
+ const createFiltersForSelectedRowData = (
+ selectedRowData: K8sClustersRowData,
+ groupBy: IBuilderQuery['groupBy'],
+ ): IBuilderQuery['filters'] => {
+ const baseFilters: IBuilderQuery['filters'] = {
+ items: [...queryFilters.items],
+ op: 'and',
+ };
+
+ if (!selectedRowData) return baseFilters;
+
+ const { groupedByMeta } = selectedRowData;
+
+ for (const key of groupBy) {
+ baseFilters.items.push({
+ key: {
+ key: key.key,
+ type: null,
+ },
+ op: '=',
+ value: groupedByMeta[key.key],
+ id: key.key,
+ });
+ }
+
+ return baseFilters;
+ };
+
+ const fetchGroupedByRowDataQuery = useMemo(() => {
+ if (!selectedRowData) return null;
+
+ const baseQuery = getK8sClustersListQuery();
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ return {
+ ...baseQuery,
+ limit: 10,
+ offset: 0,
+ filters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [minTime, maxTime, orderBy, selectedRowData, groupBy]);
+
+ const {
+ data: groupedByRowData,
+ isFetching: isFetchingGroupedByRowData,
+ isLoading: isLoadingGroupedByRowData,
+ isError: isErrorGroupedByRowData,
+ refetch: fetchGroupedByRowData,
+ } = useGetK8sClustersList(
+ fetchGroupedByRowDataQuery as K8sClustersListPayload,
+ {
+ queryKey: ['clusterList', fetchGroupedByRowDataQuery],
+ enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData,
+ },
+ );
+
+ const {
+ data: groupByFiltersData,
+ isLoading: isLoadingGroupByFilters,
+ } = useGetAggregateKeys(
+ {
+ dataSource: currentQuery.builder.queryData[0].dataSource,
+ aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.NODES],
+ aggregateOperator: 'noop',
+ searchText: '',
+ tagType: '',
+ },
+ {
+ queryKey: [currentQuery.builder.queryData[0].dataSource, 'noop'],
+ },
+ true,
+ K8sCategory.NODES,
+ );
+
+ const query = useMemo(() => {
+ const baseQuery = getK8sClustersListQuery();
+ const queryPayload = {
+ ...baseQuery,
+ limit: pageSize,
+ offset: (currentPage - 1) * pageSize,
+ filters: queryFilters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ if (groupBy.length > 0) {
+ queryPayload.groupBy = groupBy;
+ }
+ return queryPayload;
+ }, [currentPage, minTime, maxTime, orderBy, groupBy, queryFilters]);
+
+ const formattedGroupedByClustersData = useMemo(
+ () =>
+ formatDataForTable(groupedByRowData?.payload?.data?.records || [], groupBy),
+ [groupedByRowData, groupBy],
+ );
+
+ const { data, isFetching, isLoading, isError } = useGetK8sClustersList(
+ query as K8sClustersListPayload,
+ {
+ queryKey: ['clusterList', query],
+ enabled: !!query,
+ },
+ );
+
+ const clustersData = useMemo(() => data?.payload?.data?.records || [], [data]);
+ const totalCount = data?.payload?.data?.total || 0;
+
+ const formattedClustersData = useMemo(
+ () => formatDataForTable(clustersData, groupBy),
+ [clustersData, groupBy],
+ );
+
+ const columns = useMemo(() => getK8sClustersListColumns(groupBy), [groupBy]);
+
+ const handleGroupByRowClick = (record: K8sClustersRowData): void => {
+ setSelectedRowData(record);
+
+ if (expandedRowKeys.includes(record.key)) {
+ setExpandedRowKeys(expandedRowKeys.filter((key) => key !== record.key));
+ } else {
+ setExpandedRowKeys([record.key]);
+ }
+ };
+
+ useEffect(() => {
+ if (selectedRowData) {
+ fetchGroupedByRowData();
+ }
+ }, [selectedRowData, fetchGroupedByRowData]);
+
+ const handleTableChange: TableProps<K8sClustersRowData>['onChange'] = useCallback(
+ (
+ pagination: TablePaginationConfig,
+ _filters: Record<string, (string | number | boolean)[] | null>,
+ sorter:
+ | SorterResult<K8sClustersRowData>
+ | SorterResult<K8sClustersRowData>[],
+ ): void => {
+ if (pagination.current) {
+ setCurrentPage(pagination.current);
+ }
+
+ if ('field' in sorter && sorter.order) {
+ setOrderBy({
+ columnName: sorter.field as string,
+ order: sorter.order === 'ascend' ? 'asc' : 'desc',
+ });
+ } else {
+ setOrderBy(null);
+ }
+ },
+ [],
+ );
+
+ const { handleChangeQueryData } = useQueryOperations({
+ index: 0,
+ query: currentQuery.builder.queryData[0],
+ entityVersion: '',
+ });
+
+ const handleFiltersChange = useCallback(
+ (value: IBuilderQuery['filters']): void => {
+ handleChangeQueryData('filters', value);
+ setCurrentPage(1);
+
+ logEvent('Infra Monitoring: K8s list filters applied', {
+ filters: value,
+ });
+ },
+ [handleChangeQueryData],
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: K8s list page visited', {});
+ }, []);
+
+ const selectedClusterData = useMemo(() => {
+ if (!selectedClusterName) return null;
+ return (
+ clustersData.find(
+ (cluster) => cluster.meta.k8s_cluster_name === selectedClusterName,
+ ) || null
+ );
+ }, [selectedClusterName, clustersData]);
+
+ const handleRowClick = (record: K8sClustersRowData): void => {
+ if (groupBy.length === 0) {
+ setSelectedRowData(null);
+ setselectedClusterName(record.clusterUID);
+ } else {
+ handleGroupByRowClick(record);
+ }
+
+ logEvent('Infra Monitoring: K8s cluster list item clicked', {
+ clusterName: record.clusterName,
+ });
+ };
+
+ const nestedColumns = useMemo(() => getK8sClustersListColumns([]), []);
+
+ const isGroupedByAttribute = groupBy.length > 0;
+
+ const handleExpandedRowViewAllClick = (): void => {
+ if (!selectedRowData) return;
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ handleFiltersChange(filters);
+
+ setCurrentPage(1);
+ setSelectedRowData(null);
+ setGroupBy([]);
+ setOrderBy(null);
+ };
+
+ const expandedRowRender = (): JSX.Element => (
+ <div className="expanded-table-container">
+ {isErrorGroupedByRowData && (
+ <Typography>{groupedByRowData?.error || 'Something went wrong'}</Typography>
+ )}
+ {isFetchingGroupedByRowData || isLoadingGroupedByRowData ? (
+ <LoadingContainer />
+ ) : (
+ <div className="expanded-table">
+ <Table
+ columns={nestedColumns as ColumnType<K8sClustersRowData>[]}
+ dataSource={formattedGroupedByClustersData}
+ pagination={false}
+ scroll={{ x: true }}
+ tableLayout="fixed"
+ size="small"
+ loading={{
+ spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ showHeader={false}
+ />
+
+ {groupedByRowData?.payload?.data?.total &&
+ groupedByRowData?.payload?.data?.total > 10 ? (
+ <div className="expanded-table-footer">
+ <Button
+ type="default"
+ size="small"
+ className="periscope-btn secondary"
+ onClick={handleExpandedRowViewAllClick}
+ >
+ View All
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ );
+
+ const expandRowIconRenderer = ({
+ expanded,
+ onExpand,
+ record,
+ }: {
+ expanded: boolean;
+ onExpand: (
+ record: K8sClustersRowData,
+ e: React.MouseEvent<HTMLButtonElement>,
+ ) => void;
+ record: K8sClustersRowData;
+ }): JSX.Element | null => {
+ if (!isGroupedByAttribute) {
+ return null;
+ }
+
+ return expanded ? (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronDown size={14} />
+ </Button>
+ ) : (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronRight size={14} />
+ </Button>
+ );
+ };
+
+ const handleCloseClusterDetail = (): void => {
+ setselectedClusterName(null);
+ };
+
+ const handleGroupByChange = useCallback(
+ (value: IBuilderQuery['groupBy']) => {
+ const groupBy = [];
+
+ for (let index = 0; index < value.length; index++) {
+ const element = (value[index] as unknown) as string;
+
+ const key = groupByFiltersData?.payload?.attributeKeys?.find(
+ (key) => key.key === element,
+ );
+
+ if (key) {
+ groupBy.push(key);
+ }
+ }
+
+ // Reset pagination on switching to groupBy
+ setCurrentPage(1);
+ setGroupBy(groupBy);
+ setExpandedRowKeys([]);
+ },
+ [groupByFiltersData],
+ );
+
+ useEffect(() => {
+ if (groupByFiltersData?.payload) {
+ setGroupByOptions(
+ groupByFiltersData?.payload?.attributeKeys?.map((filter) => ({
+ value: filter.key,
+ label: filter.key,
+ })) || [],
+ );
+ }
+ }, [groupByFiltersData]);
+
+ return (
+ <div className="k8s-list">
+ <K8sHeader
+ isFiltersVisible={isFiltersVisible}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ defaultAddedColumns={defaultAddedColumns}
+ handleFiltersChange={handleFiltersChange}
+ groupByOptions={groupByOptions}
+ isLoadingGroupByFilters={isLoadingGroupByFilters}
+ handleGroupByChange={handleGroupByChange}
+ selectedGroupBy={groupBy}
+ entity={K8sCategory.NODES}
+ />
+ {isError && <Typography>{data?.error || 'Something went wrong'}</Typography>}
+
+ <Table
+ className="k8s-list-table clusters-list-table"
+ dataSource={isFetching || isLoading ? [] : formattedClustersData}
+ columns={columns}
+ pagination={{
+ current: currentPage,
+ pageSize,
+ total: totalCount,
+ showSizeChanger: false,
+ hideOnSinglePage: true,
+ }}
+ scroll={{ x: true }}
+ loading={{
+ spinning: isFetching || isLoading,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ locale={{
+ emptyText:
+ isFetching || isLoading ? null : (
+ <div className="no-filtered-hosts-message-container">
+ <div className="no-filtered-hosts-message-content">
+ <img
+ src="/Icons/emptyState.svg"
+ alt="thinking-emoji"
+ className="empty-state-svg"
+ />
+
+ <Typography.Text className="no-filtered-hosts-message">
+ This query had no results. Edit your query and try again!
+ </Typography.Text>
+ </div>
+ </div>
+ ),
+ }}
+ tableLayout="fixed"
+ onChange={handleTableChange}
+ onRow={(record): { onClick: () => void; className: string } => ({
+ onClick: (): void => handleRowClick(record),
+ className: 'clickable-row',
+ })}
+ expandable={{
+ expandedRowRender: isGroupedByAttribute ? expandedRowRender : undefined,
+ expandIcon: expandRowIconRenderer,
+ expandedRowKeys,
+ }}
+ />
+
+ <ClusterDetails
+ cluster={selectedClusterData}
+ isModalTimeSelection
+ onClose={handleCloseClusterDetail}
+ />
+ </div>
+ );
+}
+
+export default K8sClustersList;
diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx
new file mode 100644
index 0000000000..f03804537e
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx
@@ -0,0 +1,196 @@
+import { Color } from '@signozhq/design-tokens';
+import { Tag, Tooltip } from 'antd';
+import { ColumnType } from 'antd/es/table';
+import {
+ K8sClustersData,
+ K8sClustersListPayload,
+} from 'api/infraMonitoring/getK8sClustersList';
+import { Group } from 'lucide-react';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+
+import { formatBytes, ValidateColumnValueWrapper } from '../commonUtils';
+import { IEntityColumn } from '../utils';
+
+export const defaultAddedColumns: IEntityColumn[] = [
+ {
+ label: 'Cluster Name',
+ value: 'clusterName',
+ id: 'cluster',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Usage (cores)',
+ value: 'cpu',
+ id: 'cpu',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Allocatable (cores)',
+ value: 'cpu_allocatable',
+ id: 'cpu_allocatable',
+ canRemove: false,
+ },
+ {
+ label: 'Mem Usage',
+ value: 'memory',
+ id: 'memory',
+ canRemove: false,
+ },
+ {
+ label: 'Mem Allocatable',
+ value: 'memory_allocatable',
+ id: 'memory_allocatable',
+ canRemove: false,
+ },
+];
+
+export interface K8sClustersRowData {
+ key: string;
+ clusterUID: string;
+ clusterName: React.ReactNode;
+ cpu: React.ReactNode;
+ memory: React.ReactNode;
+ cpu_allocatable: React.ReactNode;
+ memory_allocatable: React.ReactNode;
+ groupedByMeta?: any;
+}
+
+const clusterGroupColumnConfig = {
+ title: (
+ <div className="column-header entity-group-header">
+ <Group size={14} /> CLUSTER GROUP
+ </div>
+ ),
+ dataIndex: 'clusterGroup',
+ key: 'clusterGroup',
+ ellipsis: true,
+ width: 150,
+ align: 'left',
+ sorter: false,
+ className: 'column entity-group-header',
+};
+
+export const getK8sClustersListQuery = (): K8sClustersListPayload => ({
+ filters: {
+ items: [],
+ op: 'and',
+ },
+ orderBy: { columnName: 'cpu', order: 'desc' },
+});
+
+const columnsConfig = [
+ {
+ title: <div className="column-header-left">Cluster Name</div>,
+ dataIndex: 'clusterName',
+ key: 'clusterName',
+ ellipsis: true,
+ width: 150,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">CPU Utilization (cores)</div>,
+ dataIndex: 'cpu',
+ key: 'cpu',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">CPU Allocatable (cores)</div>,
+ dataIndex: 'cpu_allocatable',
+ key: 'cpu_allocatable',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">Memory Utilization (bytes)</div>,
+ dataIndex: 'memory',
+ key: 'memory',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">Memory Allocatable (bytes)</div>,
+ dataIndex: 'memory_allocatable',
+ key: 'memory_allocatable',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+];
+
+export const getK8sClustersListColumns = (
+ groupBy: IBuilderQuery['groupBy'],
+): ColumnType<K8sClustersRowData>[] => {
+ if (groupBy.length > 0) {
+ const filteredColumns = [...columnsConfig].filter(
+ (column) => column.key !== 'clusterName',
+ );
+ filteredColumns.unshift(clusterGroupColumnConfig);
+ return filteredColumns as ColumnType<K8sClustersRowData>[];
+ }
+
+ return columnsConfig as ColumnType<K8sClustersRowData>[];
+};
+
+const getGroupByEle = (
+ cluster: K8sClustersData,
+ groupBy: IBuilderQuery['groupBy'],
+): React.ReactNode => {
+ const groupByValues: string[] = [];
+
+ groupBy.forEach((group) => {
+ groupByValues.push(cluster.meta[group.key as keyof typeof cluster.meta]);
+ });
+
+ return (
+ <div className="pod-group">
+ {groupByValues.map((value) => (
+ <Tag key={value} color={Color.BG_SLATE_400} className="pod-group-tag-item">
+ {value === '' ? '<no-value>' : value}
+ </Tag>
+ ))}
+ </div>
+ );
+};
+
+export const formatDataForTable = (
+ data: K8sClustersData[],
+ groupBy: IBuilderQuery['groupBy'],
+): K8sClustersRowData[] =>
+ data.map((cluster, index) => ({
+ key: index.toString(),
+ clusterUID: cluster.meta.k8s_cluster_name,
+ clusterName: (
+ <Tooltip title={cluster.meta.k8s_cluster_name}>
+ {cluster.meta.k8s_cluster_name}
+ </Tooltip>
+ ),
+ cpu: (
+ <ValidateColumnValueWrapper value={cluster.cpuUsage}>
+ {cluster.cpuUsage}
+ </ValidateColumnValueWrapper>
+ ),
+ memory: (
+ <ValidateColumnValueWrapper value={cluster.memoryUsage}>
+ {formatBytes(cluster.memoryUsage)}
+ </ValidateColumnValueWrapper>
+ ),
+ cpu_allocatable: (
+ <ValidateColumnValueWrapper value={cluster.cpuAllocatable}>
+ {cluster.cpuAllocatable}
+ </ValidateColumnValueWrapper>
+ ),
+ memory_allocatable: (
+ <ValidateColumnValueWrapper value={cluster.memoryAllocatable}>
+ {formatBytes(cluster.memoryAllocatable)}
+ </ValidateColumnValueWrapper>
+ ),
+ clusterGroup: getGroupByEle(cluster, groupBy),
+ meta: cluster.meta,
+ ...cluster.meta,
+ groupedByMeta: cluster.meta,
+ }));
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.interfaces.ts b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.interfaces.ts
new file mode 100644
index 0000000000..eb547aa343
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.interfaces.ts
@@ -0,0 +1,7 @@
+import { K8sDeploymentsData } from 'api/infraMonitoring/getK8sDeploymentsList';
+
+export type DeploymentDetailsProps = {
+ deployment: K8sDeploymentsData | null;
+ isModalTimeSelection: boolean;
+ onClose: () => void;
+};
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx
new file mode 100644
index 0000000000..d4f4189cf3
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/DeploymentDetails.tsx
@@ -0,0 +1,604 @@
+/* eslint-disable sonarjs/no-identical-functions */
+import '../../EntityDetailsUtils/entityDetails.styles.scss';
+
+import { Color, Spacing } from '@signozhq/design-tokens';
+import { Button, Divider, Drawer, Radio, Tooltip, Typography } from 'antd';
+import { RadioChangeEvent } from 'antd/lib';
+import logEvent from 'api/common/logEvent';
+import { K8sDeploymentsData } from 'api/infraMonitoring/getK8sDeploymentsList';
+import { VIEW_TYPES, VIEWS } from 'components/HostMetricsDetail/constants';
+import { QueryParams } from 'constants/query';
+import {
+ initialQueryBuilderFormValuesMap,
+ initialQueryState,
+} from 'constants/queryBuilder';
+import ROUTES from 'constants/routes';
+import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
+import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/utils';
+import {
+ CustomTimeType,
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/config';
+import { useIsDarkMode } from 'hooks/useDarkMode';
+import useUrlQuery from 'hooks/useUrlQuery';
+import GetMinMax from 'lib/getMinMax';
+import {
+ BarChart2,
+ ChevronsLeftRight,
+ Compass,
+ DraftingCompass,
+ ScrollText,
+ X,
+} from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import {
+ IBuilderQuery,
+ TagFilterItem,
+} from 'types/api/queryBuilder/queryBuilderData';
+import {
+ LogsAggregatorOperator,
+ TracesAggregatorOperator,
+} from 'types/common/queryBuilder';
+import { GlobalReducer } from 'types/reducer/globalTime';
+import { v4 as uuidv4 } from 'uuid';
+
+import DeploymentEvents from '../../EntityDetailsUtils/EntityEvents';
+import DeploymentLogs from '../../EntityDetailsUtils/EntityLogs';
+import DeploymentMetrics from '../../EntityDetailsUtils/EntityMetrics';
+import DeploymentTraces from '../../EntityDetailsUtils/EntityTraces';
+import {
+ deploymentWidgetInfo,
+ getDeploymentMetricsQueryPayload,
+} from './constants';
+import { DeploymentDetailsProps } from './DeploymentDetails.interfaces';
+
+function DeploymentDetails({
+ deployment,
+ onClose,
+ isModalTimeSelection,
+}: DeploymentDetailsProps): JSX.Element {
+ const { maxTime, minTime, selectedTime } = useSelector<
+ AppState,
+ GlobalReducer
+ >((state) => state.globalTime);
+
+ const startMs = useMemo(() => Math.floor(Number(minTime) / 1000000000), [
+ minTime,
+ ]);
+ const endMs = useMemo(() => Math.floor(Number(maxTime) / 1000000000), [
+ maxTime,
+ ]);
+
+ const urlQuery = useUrlQuery();
+
+ const [modalTimeRange, setModalTimeRange] = useState(() => ({
+ startTime: startMs,
+ endTime: endMs,
+ }));
+
+ const [selectedInterval, setSelectedInterval] = useState<Time>(
+ selectedTime as Time,
+ );
+
+ const [selectedView, setSelectedView] = useState<VIEWS>(VIEWS.METRICS);
+ const isDarkMode = useIsDarkMode();
+
+ const initialFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_DEPLOYMENT_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s_deployment_name--string--resource--false',
+ },
+ op: '=',
+ value: deployment?.meta.k8s_deployment_name || '',
+ },
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_NAMESPACE_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s_deployment_name--string--resource--false',
+ },
+ op: '=',
+ value: deployment?.meta.k8s_namespace_name || '',
+ },
+ ],
+ }),
+ [deployment?.meta.k8s_deployment_name, deployment?.meta.k8s_namespace_name],
+ );
+
+ const initialEventsFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_KIND,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.kind--string--resource--false',
+ },
+ op: '=',
+ value: 'Deployment',
+ },
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.name--string--resource--false',
+ },
+ op: '=',
+ value: deployment?.meta.k8s_deployment_name || '',
+ },
+ ],
+ }),
+ [deployment?.meta.k8s_deployment_name],
+ );
+
+ const [logFilters, setLogFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [tracesFilters, setTracesFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [eventsFilters, setEventsFilters] = useState<IBuilderQuery['filters']>(
+ initialEventsFilters,
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: Deployments list details page visited', {
+ deployment: deployment?.deploymentName,
+ });
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ useEffect(() => {
+ setLogFilters(initialFilters);
+ setTracesFilters(initialFilters);
+ setEventsFilters(initialEventsFilters);
+ }, [initialFilters, initialEventsFilters]);
+
+ useEffect(() => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ }, [selectedTime, minTime, maxTime]);
+
+ const handleTabChange = (e: RadioChangeEvent): void => {
+ setSelectedView(e.target.value);
+ };
+
+ const handleTimeChange = useCallback(
+ (interval: Time | CustomTimeType, dateTimeRange?: [number, number]): void => {
+ setSelectedInterval(interval as Time);
+
+ if (interval === 'custom' && dateTimeRange) {
+ setModalTimeRange({
+ startTime: Math.floor(dateTimeRange[0] / 1000),
+ endTime: Math.floor(dateTimeRange[1] / 1000),
+ });
+ } else {
+ const { maxTime, minTime } = GetMinMax(interval);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+
+ logEvent('Infra Monitoring: Deployments list details time updated', {
+ deployment: deployment?.deploymentName,
+ interval,
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeLogFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setLogFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_DEPLOYMENT_NAME, QUERY_KEYS.K8S_NAMESPACE_NAME].includes(
+ item.key?.key ?? '',
+ ),
+ );
+ const paginationFilter = value.items.find((item) => item.key?.key === 'id');
+ const newFilters = value.items.filter(
+ (item) =>
+ item.key?.key !== 'id' &&
+ item.key?.key !== QUERY_KEYS.K8S_DEPLOYMENT_NAME,
+ );
+
+ logEvent(
+ 'Infra Monitoring: Deployments list details logs filters applied',
+ {
+ deployment: deployment?.deploymentName,
+ },
+ );
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ ...primaryFilters,
+ ...newFilters,
+ ...(paginationFilter ? [paginationFilter] : []),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeTracesFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setTracesFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_DEPLOYMENT_NAME, QUERY_KEYS.K8S_NAMESPACE_NAME].includes(
+ item.key?.key ?? '',
+ ),
+ );
+
+ logEvent(
+ 'Infra Monitoring: Deployments list details traces filters applied',
+ {
+ deployment: deployment?.deploymentName,
+ },
+ );
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ ...primaryFilters,
+ ...value.items.filter(
+ (item) => item.key?.key !== QUERY_KEYS.K8S_DEPLOYMENT_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeEventsFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setEventsFilters((prevFilters) => {
+ const deploymentKindFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_KIND,
+ );
+ const deploymentNameFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_NAME,
+ );
+
+ logEvent(
+ 'Infra Monitoring: Deployments list details events filters applied',
+ {
+ deployment: deployment?.deploymentName,
+ },
+ );
+
+ return {
+ op: 'AND',
+ items: filterDuplicateFilters(
+ [
+ deploymentKindFilter,
+ deploymentNameFilter,
+ ...value.items.filter(
+ (item) =>
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_KIND &&
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ ),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleExplorePagesRedirect = (): void => {
+ if (selectedInterval !== 'custom') {
+ urlQuery.set(QueryParams.relativeTime, selectedInterval);
+ } else {
+ urlQuery.delete(QueryParams.relativeTime);
+ urlQuery.set(QueryParams.startTime, modalTimeRange.startTime.toString());
+ urlQuery.set(QueryParams.endTime, modalTimeRange.endTime.toString());
+ }
+
+ logEvent('Infra Monitoring: Deployments list details explore clicked', {
+ deployment: deployment?.deploymentName,
+ view: selectedView,
+ });
+
+ if (selectedView === VIEW_TYPES.LOGS) {
+ const filtersWithoutPagination = {
+ ...logFilters,
+ items: logFilters.items.filter((item) => item.key?.key !== 'id'),
+ };
+
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.logs,
+ aggregateOperator: LogsAggregatorOperator.NOOP,
+ filters: filtersWithoutPagination,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.LOGS_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ } else if (selectedView === VIEW_TYPES.TRACES) {
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.traces,
+ aggregateOperator: TracesAggregatorOperator.NOOP,
+ filters: tracesFilters,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.TRACES_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ }
+ };
+
+ const handleClose = (): void => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ setSelectedView(VIEW_TYPES.METRICS);
+ onClose();
+ };
+
+ return (
+ <Drawer
+ width="70%"
+ title={
+ <>
+ <Divider type="vertical" />
+ <Typography.Text className="title">
+ {deployment?.meta.k8s_deployment_name}
+ </Typography.Text>
+ </>
+ }
+ placement="right"
+ onClose={handleClose}
+ open={!!deployment}
+ style={{
+ overscrollBehavior: 'contain',
+ background: isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100,
+ }}
+ className="entity-detail-drawer"
+ destroyOnClose
+ closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
+ >
+ {deployment && (
+ <>
+ <div className="entity-detail-drawer__entity">
+ <div className="entity-details-grid">
+ <div className="labels-row">
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Deployment Name
+ </Typography.Text>
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Cluster Name
+ </Typography.Text>
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Namespace Name
+ </Typography.Text>
+ </div>
+ <div className="values-row">
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title={deployment.meta.k8s_deployment_name}>
+ {deployment.meta.k8s_deployment_name}
+ </Tooltip>
+ </Typography.Text>
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title={deployment.meta.k8s_cluster_name}>
+ {deployment.meta.k8s_cluster_name}
+ </Tooltip>
+ </Typography.Text>
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title={deployment.meta.k8s_namespace_name}>
+ {deployment.meta.k8s_namespace_name}
+ </Tooltip>
+ </Typography.Text>
+ </div>
+ </div>
+ </div>
+
+ <div className="views-tabs-container">
+ <Radio.Group
+ className="views-tabs"
+ onChange={handleTabChange}
+ value={selectedView}
+ >
+ <Radio.Button
+ className={
+ // eslint-disable-next-line sonarjs/no-duplicate-string
+ selectedView === VIEW_TYPES.METRICS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.METRICS}
+ >
+ <div className="view-title">
+ <BarChart2 size={14} />
+ Metrics
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.LOGS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.LOGS}
+ >
+ <div className="view-title">
+ <ScrollText size={14} />
+ Logs
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.TRACES ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.TRACES}
+ >
+ <div className="view-title">
+ <DraftingCompass size={14} />
+ Traces
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.EVENTS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.EVENTS}
+ >
+ <div className="view-title">
+ <ChevronsLeftRight size={14} />
+ Events
+ </div>
+ </Radio.Button>
+ </Radio.Group>
+
+ {(selectedView === VIEW_TYPES.LOGS ||
+ selectedView === VIEW_TYPES.TRACES) && (
+ <Button
+ icon={<Compass size={18} />}
+ className="compass-button"
+ onClick={handleExplorePagesRedirect}
+ />
+ )}
+ </div>
+ {selectedView === VIEW_TYPES.METRICS && (
+ <DeploymentMetrics<K8sDeploymentsData>
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ entity={deployment}
+ entityWidgetInfo={deploymentWidgetInfo}
+ getEntityQueryPayload={getDeploymentMetricsQueryPayload}
+ category={K8sCategory.DEPLOYMENTS}
+ queryKey="deploymentMetrics"
+ />
+ )}
+ {selectedView === VIEW_TYPES.LOGS && (
+ <DeploymentLogs
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeLogFilters={handleChangeLogFilters}
+ logFilters={logFilters}
+ selectedInterval={selectedInterval}
+ queryKeyFilters={[
+ QUERY_KEYS.K8S_DEPLOYMENT_NAME,
+ QUERY_KEYS.K8S_NAMESPACE_NAME,
+ ]}
+ queryKey="deploymentLogs"
+ category={K8sCategory.DEPLOYMENTS}
+ />
+ )}
+ {selectedView === VIEW_TYPES.TRACES && (
+ <DeploymentTraces
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeTracesFilters={handleChangeTracesFilters}
+ tracesFilters={tracesFilters}
+ selectedInterval={selectedInterval}
+ queryKey="deploymentTraces"
+ />
+ )}
+ {selectedView === VIEW_TYPES.EVENTS && (
+ <DeploymentEvents
+ timeRange={modalTimeRange}
+ handleChangeEventFilters={handleChangeEventsFilters}
+ filters={eventsFilters}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ category={K8sCategory.DEPLOYMENTS}
+ queryKey="deploymentEvents"
+ />
+ )}
+ </>
+ )}
+ </Drawer>
+ );
+}
+
+export default DeploymentDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts
new file mode 100644
index 0000000000..c6481481b1
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts
@@ -0,0 +1,544 @@
+/* eslint-disable sonarjs/no-duplicate-string */
+import { K8sDeploymentsData } from 'api/infraMonitoring/getK8sDeploymentsList';
+import { PANEL_TYPES } from 'constants/queryBuilder';
+import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { EQueryType } from 'types/common/dashboard';
+import { DataSource } from 'types/common/queryBuilder';
+import { v4 } from 'uuid';
+
+export const deploymentWidgetInfo = [
+ {
+ title: 'CPU usage, request, limits',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Memory usage, request, limits)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Network IO',
+ yAxisUnit: 'binBps',
+ },
+ {
+ title: 'Network error count',
+ yAxisUnit: '',
+ },
+];
+
+export const getDeploymentMetricsQueryPayload = (
+ deployment: K8sDeploymentsData,
+ 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: 'aec60cba',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_cpu_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_cpu_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'd047ec14',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ op: 'contains',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_cpu_limit--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_cpu_limit',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '750b7856',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ op: 'contains',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'limits',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ 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,
+ 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: '768c2f47',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'usage',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '1a96fa81',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ op: 'contains',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_limit--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_limit',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'e69a2b7e',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ op: 'contains',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'limits',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_pod_network_io--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_network_io',
+ type: 'Sum',
+ },
+ aggregateOperator: 'rate',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '8b550f6d',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'rate',
+ },
+ ],
+ 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_network_errors--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_network_errors',
+ type: 'Sum',
+ },
+ aggregateOperator: 'increase',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'e16c1e4a',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: deployment.meta.k8s_deployment_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'increase',
+ },
+ ],
+ 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,
+ },
+];
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/index.ts b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/index.ts
new file mode 100644
index 0000000000..8fb076b645
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/index.ts
@@ -0,0 +1,3 @@
+import DeploymentDetails from './DeploymentDetails';
+
+export default DeploymentDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.styles.scss b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.styles.scss
new file mode 100644
index 0000000000..e5c3027873
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.styles.scss
@@ -0,0 +1,57 @@
+.infra-monitoring-container {
+ .deployments-list-table {
+ .expanded-table-container {
+ padding-left: 20px;
+ }
+
+ .ant-table-row-expand-icon-cell {
+ min-width: 30px !important;
+ max-width: 30px !important;
+ }
+ }
+}
+
+.ant-table-cell {
+ &:has(.deployment-name-header) {
+ min-width: 250px !important;
+ max-width: 250px !important;
+ }
+}
+
+.ant-table-cell {
+ &:has(.namespace-name-header) {
+ min-width: 220px !important;
+ max-width: 220px !important;
+ }
+}
+
+.ant-table-cell {
+ &:has(.med-col) {
+ min-width: 200px !important;
+ max-width: 200px !important;
+ }
+}
+
+.ant-table-cell {
+ &:has(.small-col) {
+ min-width: 120px !important;
+ max-width: 120px !important;
+ }
+}
+
+.progress-container {
+ display: flex !important;
+ justify-content: start !important;
+}
+
+.expanded-deployments-list-table {
+ .ant-table-cell {
+ min-width: 180px !important;
+ max-width: 180px !important;
+ }
+
+ .ant-table-row-expand-icon-cell {
+ min-width: 30px !important;
+ max-width: 30px !important;
+ }
+}
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx
new file mode 100644
index 0000000000..5e5d0ff489
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx
@@ -0,0 +1,518 @@
+/* eslint-disable no-restricted-syntax */
+/* eslint-disable @typescript-eslint/explicit-function-return-type */
+import '../InfraMonitoringK8s.styles.scss';
+import './K8sDeploymentsList.styles.scss';
+
+import { LoadingOutlined } from '@ant-design/icons';
+import {
+ Button,
+ Spin,
+ Table,
+ TablePaginationConfig,
+ TableProps,
+ Typography,
+} from 'antd';
+import { ColumnType, SorterResult } from 'antd/es/table/interface';
+import logEvent from 'api/common/logEvent';
+import { K8sDeploymentsListPayload } from 'api/infraMonitoring/getK8sDeploymentsList';
+import classNames from 'classnames';
+import { useGetK8sDeploymentsList } from 'hooks/infraMonitoring/useGetK8sDeploymentsList';
+import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
+import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
+import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
+import { ChevronDown, ChevronRight } from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { GlobalReducer } from 'types/reducer/globalTime';
+
+import {
+ K8sCategory,
+ K8sEntityToAggregateAttributeMapping,
+} from '../constants';
+import K8sHeader from '../K8sHeader';
+import LoadingContainer from '../LoadingContainer';
+import DeploymentDetails from './DeploymentDetails';
+import {
+ defaultAddedColumns,
+ formatDataForTable,
+ getK8sDeploymentsListColumns,
+ getK8sDeploymentsListQuery,
+ K8sDeploymentsRowData,
+} from './utils';
+
+// eslint-disable-next-line sonarjs/cognitive-complexity
+function K8sDeploymentsList({
+ isFiltersVisible,
+ handleFilterVisibilityChange,
+ quickFiltersLastUpdated,
+}: {
+ isFiltersVisible: boolean;
+ handleFilterVisibilityChange: () => void;
+ quickFiltersLastUpdated: number;
+}): JSX.Element {
+ const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
+ (state) => state.globalTime,
+ );
+
+ const [currentPage, setCurrentPage] = useState(1);
+
+ const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
+
+ const [orderBy, setOrderBy] = useState<{
+ columnName: string;
+ order: 'asc' | 'desc';
+ } | null>(null);
+
+ const [selectedDeploymentUID, setselectedDeploymentUID] = useState<
+ string | null
+ >(null);
+
+ const pageSize = 10;
+
+ const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>([]);
+
+ const [
+ selectedRowData,
+ setSelectedRowData,
+ ] = useState<K8sDeploymentsRowData | null>(null);
+
+ const [groupByOptions, setGroupByOptions] = useState<
+ { value: string; label: string }[]
+ >([]);
+
+ const { currentQuery } = useQueryBuilder();
+
+ const queryFilters = useMemo(
+ () =>
+ currentQuery?.builder?.queryData[0]?.filters || {
+ items: [],
+ op: 'and',
+ },
+ [currentQuery?.builder?.queryData],
+ );
+
+ // Reset pagination every time quick filters are changed
+ useEffect(() => {
+ setCurrentPage(1);
+ }, [quickFiltersLastUpdated]);
+
+ const createFiltersForSelectedRowData = (
+ selectedRowData: K8sDeploymentsRowData,
+ groupBy: IBuilderQuery['groupBy'],
+ ): IBuilderQuery['filters'] => {
+ const baseFilters: IBuilderQuery['filters'] = {
+ items: [...queryFilters.items],
+ op: 'and',
+ };
+
+ if (!selectedRowData) return baseFilters;
+
+ const { groupedByMeta } = selectedRowData;
+
+ for (const key of groupBy) {
+ baseFilters.items.push({
+ key: {
+ key: key.key,
+ type: null,
+ },
+ op: '=',
+ value: groupedByMeta[key.key],
+ id: key.key,
+ });
+ }
+
+ return baseFilters;
+ };
+
+ const fetchGroupedByRowDataQuery = useMemo(() => {
+ if (!selectedRowData) return null;
+
+ const baseQuery = getK8sDeploymentsListQuery();
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ return {
+ ...baseQuery,
+ limit: 10,
+ offset: 0,
+ filters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [minTime, maxTime, orderBy, selectedRowData, groupBy]);
+
+ const {
+ data: groupedByRowData,
+ isFetching: isFetchingGroupedByRowData,
+ isLoading: isLoadingGroupedByRowData,
+ isError: isErrorGroupedByRowData,
+ refetch: fetchGroupedByRowData,
+ } = useGetK8sDeploymentsList(
+ fetchGroupedByRowDataQuery as K8sDeploymentsListPayload,
+ {
+ queryKey: ['deploymentList', fetchGroupedByRowDataQuery],
+ enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData,
+ },
+ );
+
+ const {
+ data: groupByFiltersData,
+ isLoading: isLoadingGroupByFilters,
+ } = useGetAggregateKeys(
+ {
+ dataSource: currentQuery.builder.queryData[0].dataSource,
+ aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.NODES],
+ aggregateOperator: 'noop',
+ searchText: '',
+ tagType: '',
+ },
+ {
+ queryKey: [currentQuery.builder.queryData[0].dataSource, 'noop'],
+ },
+ true,
+ K8sCategory.NODES,
+ );
+
+ const query = useMemo(() => {
+ const baseQuery = getK8sDeploymentsListQuery();
+ const queryPayload = {
+ ...baseQuery,
+ limit: pageSize,
+ offset: (currentPage - 1) * pageSize,
+ filters: queryFilters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ if (groupBy.length > 0) {
+ queryPayload.groupBy = groupBy;
+ }
+ return queryPayload;
+ }, [currentPage, minTime, maxTime, orderBy, groupBy, queryFilters]);
+
+ const formattedGroupedByDeploymentsData = useMemo(
+ () =>
+ formatDataForTable(groupedByRowData?.payload?.data?.records || [], groupBy),
+ [groupedByRowData, groupBy],
+ );
+
+ const { data, isFetching, isLoading, isError } = useGetK8sDeploymentsList(
+ query as K8sDeploymentsListPayload,
+ {
+ queryKey: ['deploymentList', query],
+ enabled: !!query,
+ },
+ );
+
+ const deploymentsData = useMemo(() => data?.payload?.data?.records || [], [
+ data,
+ ]);
+ const totalCount = data?.payload?.data?.total || 0;
+
+ const formattedDeploymentsData = useMemo(
+ () => formatDataForTable(deploymentsData, groupBy),
+ [deploymentsData, groupBy],
+ );
+
+ const columns = useMemo(() => getK8sDeploymentsListColumns(groupBy), [
+ groupBy,
+ ]);
+
+ const handleGroupByRowClick = (record: K8sDeploymentsRowData): void => {
+ setSelectedRowData(record);
+
+ if (expandedRowKeys.includes(record.key)) {
+ setExpandedRowKeys(expandedRowKeys.filter((key) => key !== record.key));
+ } else {
+ setExpandedRowKeys([record.key]);
+ }
+ };
+
+ useEffect(() => {
+ if (selectedRowData) {
+ fetchGroupedByRowData();
+ }
+ }, [selectedRowData, fetchGroupedByRowData]);
+
+ const handleTableChange: TableProps<K8sDeploymentsRowData>['onChange'] = useCallback(
+ (
+ pagination: TablePaginationConfig,
+ _filters: Record<string, (string | number | boolean)[] | null>,
+ sorter:
+ | SorterResult<K8sDeploymentsRowData>
+ | SorterResult<K8sDeploymentsRowData>[],
+ ): void => {
+ if (pagination.current) {
+ setCurrentPage(pagination.current);
+ }
+
+ if ('field' in sorter && sorter.order) {
+ setOrderBy({
+ columnName: sorter.field as string,
+ order: sorter.order === 'ascend' ? 'asc' : 'desc',
+ });
+ } else {
+ setOrderBy(null);
+ }
+ },
+ [],
+ );
+
+ const { handleChangeQueryData } = useQueryOperations({
+ index: 0,
+ query: currentQuery.builder.queryData[0],
+ entityVersion: '',
+ });
+
+ const handleFiltersChange = useCallback(
+ (value: IBuilderQuery['filters']): void => {
+ handleChangeQueryData('filters', value);
+ setCurrentPage(1);
+
+ logEvent('Infra Monitoring: K8s list filters applied', {
+ filters: value,
+ });
+ },
+ [handleChangeQueryData],
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: K8s list page visited', {});
+ }, []);
+
+ const selectedDeploymentData = useMemo(() => {
+ if (!selectedDeploymentUID) return null;
+ return (
+ deploymentsData.find(
+ (deployment) => deployment.deploymentName === selectedDeploymentUID,
+ ) || null
+ );
+ }, [selectedDeploymentUID, deploymentsData]);
+
+ const handleRowClick = (record: K8sDeploymentsRowData): void => {
+ if (groupBy.length === 0) {
+ setSelectedRowData(null);
+ setselectedDeploymentUID(record.deploymentUID);
+ } else {
+ handleGroupByRowClick(record);
+ }
+
+ logEvent('Infra Monitoring: K8s deployment list item clicked', {
+ deploymentUID: record.deploymentName,
+ });
+ };
+
+ const nestedColumns = useMemo(() => getK8sDeploymentsListColumns([]), []);
+
+ const isGroupedByAttribute = groupBy.length > 0;
+
+ const handleExpandedRowViewAllClick = (): void => {
+ if (!selectedRowData) return;
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ handleFiltersChange(filters);
+
+ setCurrentPage(1);
+ setSelectedRowData(null);
+ setGroupBy([]);
+ setOrderBy(null);
+ };
+
+ const expandedRowRender = (): JSX.Element => (
+ <div className="expanded-table-container">
+ {isErrorGroupedByRowData && (
+ <Typography>{groupedByRowData?.error || 'Something went wrong'}</Typography>
+ )}
+ {isFetchingGroupedByRowData || isLoadingGroupedByRowData ? (
+ <LoadingContainer />
+ ) : (
+ <div className="expanded-table">
+ <Table
+ columns={nestedColumns as ColumnType<K8sDeploymentsRowData>[]}
+ dataSource={formattedGroupedByDeploymentsData}
+ pagination={false}
+ scroll={{ x: true }}
+ tableLayout="fixed"
+ size="small"
+ loading={{
+ spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ showHeader={false}
+ />
+
+ {groupedByRowData?.payload?.data?.total &&
+ groupedByRowData?.payload?.data?.total > 10 ? (
+ <div className="expanded-table-footer">
+ <Button
+ type="default"
+ size="small"
+ className="periscope-btn secondary"
+ onClick={handleExpandedRowViewAllClick}
+ >
+ View All
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ );
+
+ const expandRowIconRenderer = ({
+ expanded,
+ onExpand,
+ record,
+ }: {
+ expanded: boolean;
+ onExpand: (
+ record: K8sDeploymentsRowData,
+ e: React.MouseEvent<HTMLButtonElement>,
+ ) => void;
+ record: K8sDeploymentsRowData;
+ }): JSX.Element | null => {
+ if (!isGroupedByAttribute) {
+ return null;
+ }
+
+ return expanded ? (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronDown size={14} />
+ </Button>
+ ) : (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronRight size={14} />
+ </Button>
+ );
+ };
+
+ const handleCloseDeploymentDetail = (): void => {
+ setselectedDeploymentUID(null);
+ };
+
+ const handleGroupByChange = useCallback(
+ (value: IBuilderQuery['groupBy']) => {
+ const groupBy = [];
+
+ for (let index = 0; index < value.length; index++) {
+ const element = (value[index] as unknown) as string;
+
+ const key = groupByFiltersData?.payload?.attributeKeys?.find(
+ (key) => key.key === element,
+ );
+
+ if (key) {
+ groupBy.push(key);
+ }
+ }
+
+ // Reset pagination on switching to groupBy
+ setCurrentPage(1);
+ setGroupBy(groupBy);
+ setExpandedRowKeys([]);
+ },
+ [groupByFiltersData],
+ );
+
+ useEffect(() => {
+ if (groupByFiltersData?.payload) {
+ setGroupByOptions(
+ groupByFiltersData?.payload?.attributeKeys?.map((filter) => ({
+ value: filter.key,
+ label: filter.key,
+ })) || [],
+ );
+ }
+ }, [groupByFiltersData]);
+
+ return (
+ <div className="k8s-list">
+ <K8sHeader
+ isFiltersVisible={isFiltersVisible}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ defaultAddedColumns={defaultAddedColumns}
+ handleFiltersChange={handleFiltersChange}
+ groupByOptions={groupByOptions}
+ isLoadingGroupByFilters={isLoadingGroupByFilters}
+ handleGroupByChange={handleGroupByChange}
+ selectedGroupBy={groupBy}
+ entity={K8sCategory.NODES}
+ />
+ {isError && <Typography>{data?.error || 'Something went wrong'}</Typography>}
+
+ <Table
+ className={classNames('k8s-list-table', 'deployments-list-table', {
+ 'expanded-deployments-list-table': isGroupedByAttribute,
+ })}
+ dataSource={isFetching || isLoading ? [] : formattedDeploymentsData}
+ columns={columns}
+ pagination={{
+ current: currentPage,
+ pageSize,
+ total: totalCount,
+ showSizeChanger: false,
+ hideOnSinglePage: true,
+ }}
+ scroll={{ x: true }}
+ loading={{
+ spinning: isFetching || isLoading,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ locale={{
+ emptyText:
+ isFetching || isLoading ? null : (
+ <div className="no-filtered-hosts-message-container">
+ <div className="no-filtered-hosts-message-content">
+ <img
+ src="/Icons/emptyState.svg"
+ alt="thinking-emoji"
+ className="empty-state-svg"
+ />
+
+ <Typography.Text className="no-filtered-hosts-message">
+ This query had no results. Edit your query and try again!
+ </Typography.Text>
+ </div>
+ </div>
+ ),
+ }}
+ tableLayout="fixed"
+ onChange={handleTableChange}
+ onRow={(record): { onClick: () => void; className: string } => ({
+ onClick: (): void => handleRowClick(record),
+ className: 'clickable-row',
+ })}
+ expandable={{
+ expandedRowRender: isGroupedByAttribute ? expandedRowRender : undefined,
+ expandIcon: expandRowIconRenderer,
+ expandedRowKeys,
+ }}
+ />
+
+ <DeploymentDetails
+ deployment={selectedDeploymentData}
+ isModalTimeSelection
+ onClose={handleCloseDeploymentDetail}
+ />
+ </div>
+ );
+}
+
+export default K8sDeploymentsList;
diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx
new file mode 100644
index 0000000000..28e8ab79cc
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx
@@ -0,0 +1,323 @@
+import { Color } from '@signozhq/design-tokens';
+import { Tag, Tooltip } from 'antd';
+import { ColumnType } from 'antd/es/table';
+import {
+ K8sDeploymentsData,
+ K8sDeploymentsListPayload,
+} from 'api/infraMonitoring/getK8sDeploymentsList';
+import { Group } from 'lucide-react';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+
+import {
+ EntityProgressBar,
+ formatBytes,
+ ValidateColumnValueWrapper,
+} from '../commonUtils';
+import { IEntityColumn } from '../utils';
+
+export const defaultAddedColumns: IEntityColumn[] = [
+ {
+ label: 'Deployment Name',
+ value: 'deploymentName',
+ id: 'deploymentName',
+ canRemove: false,
+ },
+ {
+ label: 'Namespace Name',
+ value: 'namespaceName',
+ id: 'namespaceName',
+ canRemove: false,
+ },
+ {
+ label: 'Available',
+ value: 'available',
+ id: 'available',
+ canRemove: false,
+ },
+ {
+ label: 'Desired',
+ value: 'desired',
+ id: 'desired',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Request Utilization (% of limit)',
+ value: 'cpu_request',
+ id: 'cpu_request',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Limit Utilization (% of request)',
+ value: 'cpu_limit',
+ id: 'cpu_limit',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Utilization (cores)',
+ value: 'cpu',
+ id: 'cpu',
+ canRemove: false,
+ },
+ {
+ label: 'Memory Request Utilization (% of limit)',
+ value: 'memory_request',
+ id: 'memory_request',
+ canRemove: false,
+ },
+ {
+ label: 'Memory Limit Utilization (% of request)',
+ value: 'memory_limit',
+ id: 'memory_limit',
+ canRemove: false,
+ },
+ {
+ label: 'Memory Utilization (bytes)',
+ value: 'memory',
+ id: 'memory',
+ canRemove: false,
+ },
+];
+
+export interface K8sDeploymentsRowData {
+ key: string;
+ deploymentUID: string;
+ deploymentName: React.ReactNode;
+ availableReplicas: React.ReactNode;
+ desiredReplicas: React.ReactNode;
+ cpu_request: React.ReactNode;
+ cpu_limit: React.ReactNode;
+ cpu: React.ReactNode;
+ memory_request: React.ReactNode;
+ memory_limit: React.ReactNode;
+ memory: React.ReactNode;
+ restarts: React.ReactNode;
+ clusterName: string;
+ namespaceName: string;
+ groupedByMeta?: any;
+}
+
+const deploymentGroupColumnConfig = {
+ title: (
+ <div className="column-header entity-group-header">
+ <Group size={14} /> DEPLOYMENT GROUP
+ </div>
+ ),
+ dataIndex: 'deploymentGroup',
+ key: 'deploymentGroup',
+ ellipsis: true,
+ width: 150,
+ align: 'left',
+ sorter: false,
+ className: 'column entity-group-header',
+};
+
+export const getK8sDeploymentsListQuery = (): K8sDeploymentsListPayload => ({
+ filters: {
+ items: [],
+ op: 'and',
+ },
+ orderBy: { columnName: 'cpu', order: 'desc' },
+});
+
+const columnsConfig = [
+ {
+ title: (
+ <div className="column-header-left deployment-name-header">
+ Deployment Name
+ </div>
+ ),
+ dataIndex: 'deploymentName',
+ key: 'deploymentName',
+ ellipsis: true,
+ width: 150,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: (
+ <div className="column-header-left namespace-name-header">
+ Namespace Name
+ </div>
+ ),
+ dataIndex: 'namespaceName',
+ key: 'namespaceName',
+ ellipsis: true,
+ width: 150,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left small-col">Available</div>,
+ dataIndex: 'availableReplicas',
+ key: 'availableReplicas',
+ width: 100,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left small-col">Desired</div>,
+ dataIndex: 'desiredReplicas',
+ key: 'desiredReplicas',
+ width: 80,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left med-col">CPU Req Usage (%)</div>,
+ dataIndex: 'cpu_request',
+ key: 'cpu_request',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left med-col">CPU Limit Usage (%)</div>,
+ dataIndex: 'cpu_limit',
+ key: 'cpu_limit',
+ width: 50,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header- small-col">CPU Usage (cores)</div>,
+ dataIndex: 'cpu',
+ key: 'cpu',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left med-col">Mem Req Usage (%)</div>,
+ dataIndex: 'memory_request',
+ key: 'memory_request',
+ width: 50,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left med-col">Mem Limit Usage (%)</div>,
+ dataIndex: 'memory_limit',
+ key: 'memory_limit',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left small-col">Mem Usage</div>,
+ dataIndex: 'memory',
+ key: 'memory',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+];
+
+export const getK8sDeploymentsListColumns = (
+ groupBy: IBuilderQuery['groupBy'],
+): ColumnType<K8sDeploymentsRowData>[] => {
+ if (groupBy.length > 0) {
+ const filteredColumns = [...columnsConfig].filter(
+ (column) => column.key !== 'deploymentName',
+ );
+ filteredColumns.unshift(deploymentGroupColumnConfig);
+ return filteredColumns as ColumnType<K8sDeploymentsRowData>[];
+ }
+
+ return columnsConfig as ColumnType<K8sDeploymentsRowData>[];
+};
+
+const getGroupByEle = (
+ deployment: K8sDeploymentsData,
+ groupBy: IBuilderQuery['groupBy'],
+): React.ReactNode => {
+ const groupByValues: string[] = [];
+
+ groupBy.forEach((group) => {
+ groupByValues.push(
+ deployment.meta[group.key as keyof typeof deployment.meta],
+ );
+ });
+
+ return (
+ <div className="pod-group">
+ {groupByValues.map((value) => (
+ <Tag key={value} color={Color.BG_SLATE_400} className="pod-group-tag-item">
+ {value === '' ? '<no-value>' : value}
+ </Tag>
+ ))}
+ </div>
+ );
+};
+
+export const formatDataForTable = (
+ data: K8sDeploymentsData[],
+ groupBy: IBuilderQuery['groupBy'],
+): K8sDeploymentsRowData[] =>
+ data.map((deployment, index) => ({
+ key: index.toString(),
+ deploymentUID: deployment.meta.k8s_deployment_name,
+ deploymentName: (
+ <Tooltip title={deployment.meta.k8s_deployment_name}>
+ {deployment.meta.k8s_deployment_name}
+ </Tooltip>
+ ),
+ availableReplicas: (
+ <ValidateColumnValueWrapper value={deployment.availablePods}>
+ {deployment.availablePods}
+ </ValidateColumnValueWrapper>
+ ),
+ desiredReplicas: (
+ <ValidateColumnValueWrapper value={deployment.desiredPods}>
+ {deployment.desiredPods}
+ </ValidateColumnValueWrapper>
+ ),
+ restarts: (
+ <ValidateColumnValueWrapper value={deployment.restarts}>
+ {deployment.restarts}
+ </ValidateColumnValueWrapper>
+ ),
+ cpu: (
+ <ValidateColumnValueWrapper value={deployment.cpuUsage}>
+ {deployment.cpuUsage}
+ </ValidateColumnValueWrapper>
+ ),
+ cpu_request: (
+ <ValidateColumnValueWrapper value={deployment.cpuRequest}>
+ <div className="progress-container">
+ <EntityProgressBar value={deployment.cpuRequest} type="request" />
+ </div>
+ </ValidateColumnValueWrapper>
+ ),
+ cpu_limit: (
+ <ValidateColumnValueWrapper value={deployment.cpuLimit}>
+ <div className="progress-container">
+ <EntityProgressBar value={deployment.cpuLimit} type="limit" />
+ </div>
+ </ValidateColumnValueWrapper>
+ ),
+ memory: (
+ <ValidateColumnValueWrapper value={deployment.memoryUsage}>
+ {formatBytes(deployment.memoryUsage)}
+ </ValidateColumnValueWrapper>
+ ),
+ memory_request: (
+ <ValidateColumnValueWrapper value={deployment.memoryRequest}>
+ <div className="progress-container">
+ <EntityProgressBar value={deployment.memoryRequest} type="request" />
+ </div>
+ </ValidateColumnValueWrapper>
+ ),
+ memory_limit: (
+ <ValidateColumnValueWrapper value={deployment.memoryLimit}>
+ <div className="progress-container">
+ <EntityProgressBar value={deployment.memoryLimit} type="limit" />
+ </div>
+ </ValidateColumnValueWrapper>
+ ),
+ clusterName: deployment.meta.k8s_cluster_name,
+ namespaceName: deployment.meta.k8s_namespace_name,
+ deploymentGroup: getGroupByEle(deployment, groupBy),
+ meta: deployment.meta,
+ ...deployment.meta,
+ groupedByMeta: deployment.meta,
+ }));
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
similarity index 84%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.tsx
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
index 65109b0dca..67b4722ba3 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/EntityEvents.tsx
@@ -1,10 +1,11 @@
/* eslint-disable no-nested-ternary */
-import './NodeEvents.styles.scss';
+import './entityEvents.styles.scss';
import { Color } from '@signozhq/design-tokens';
import { Button, Table, TableColumnsType } from 'antd';
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
import { EventContents } from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
import LoadingContainer from 'container/InfraMonitoringK8s/LoadingContainer';
import LogsError from 'container/LogsError/LogsError';
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
@@ -25,8 +26,10 @@ import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
import { v4 } from 'uuid';
-import { getNodesEventsQueryPayload } from './constants';
-import NoEventsContainer from './NoEventsContainer';
+import {
+ EntityDetailsEmptyContainer,
+ getEntityEventsOrLogsQueryPayload,
+} from '../utils';
interface EventDataType {
key: string;
@@ -48,7 +51,7 @@ interface EventDataType {
severity?: string;
}
-interface INodeEventsProps {
+interface IEntityEventsProps {
timeRange: {
startTime: number;
endTime: number;
@@ -61,6 +64,8 @@ interface INodeEventsProps {
dateTimeRange?: [number, number],
) => void;
selectedInterval: Time;
+ category: K8sCategory;
+ queryKey: string;
}
const EventsPageSize = 10;
@@ -72,10 +77,12 @@ export default function Events({
isModalTimeSelection,
handleTimeChange,
selectedInterval,
-}: INodeEventsProps): JSX.Element {
+ category,
+ queryKey,
+}: IEntityEventsProps): JSX.Element {
const { currentQuery } = useQueryBuilder();
- const [formattedNodeEvents, setFormattedNodeEvents] = useState<
+ const [formattedEntityEvents, setFormattedEntityEvents] = useState<
EventDataType[]
>([]);
@@ -110,7 +117,7 @@ export default function Events({
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
const queryPayload = useMemo(() => {
- const basePayload = getNodesEventsQueryPayload(
+ const basePayload = getEntityEventsOrLogsQueryPayload(
timeRange.startTime,
timeRange.endTime,
filters,
@@ -125,7 +132,7 @@ export default function Events({
}, [timeRange.startTime, timeRange.endTime, filters]);
const { data: eventsData, isLoading, isFetching, isError } = useQuery({
- queryKey: ['nodeEvents', timeRange.startTime, timeRange.endTime, filters],
+ queryKey: [queryKey, timeRange.startTime, timeRange.endTime, filters],
queryFn: () => GetMetricQueryRange(queryPayload, DEFAULT_ENTITY_VERSION),
enabled: !!queryPayload,
});
@@ -159,7 +166,7 @@ export default function Events({
}),
);
- setFormattedNodeEvents(formattedData);
+ setFormattedEntityEvents(formattedData);
if (
!responsePayload ||
@@ -181,11 +188,11 @@ export default function Events({
);
const handlePrev = (): void => {
- if (!formattedNodeEvents.length) return;
+ if (!formattedEntityEvents.length) return;
setPage(page - 1);
- const firstEvent = formattedNodeEvents[0];
+ const firstEvent = formattedEntityEvents[0];
const newItems = [
...filters.items.filter((item) => item.key?.key !== 'id'),
@@ -211,10 +218,10 @@ export default function Events({
};
const handleNext = (): void => {
- if (!formattedNodeEvents.length) return;
+ if (!formattedEntityEvents.length) return;
setPage(page + 1);
- const lastEvent = formattedNodeEvents[formattedNodeEvents.length - 1];
+ const lastEvent = formattedEntityEvents[formattedEntityEvents.length - 1];
const newItems = [
...filters.items.filter((item) => item.key?.key !== 'id'),
@@ -277,8 +284,8 @@ export default function Events({
);
return (
- <div className="node-events-container">
- <div className="node-events-header">
+ <div className="entity-events-container">
+ <div className="entity-events-header">
<div className="filter-section">
{query && (
<QueryBuilderSearch
@@ -303,15 +310,15 @@ export default function Events({
{isLoading && <LoadingContainer />}
- {!isLoading && !isError && formattedNodeEvents.length === 0 && (
- <NoEventsContainer />
+ {!isLoading && !isError && formattedEntityEvents.length === 0 && (
+ <EntityDetailsEmptyContainer category={category} view="events" />
)}
{isError && !isLoading && <LogsError />}
- {!isLoading && !isError && formattedNodeEvents.length > 0 && (
- <div className="node-events-list-container">
- <div className="node-events-list-card">
+ {!isLoading && !isError && formattedEntityEvents.length > 0 && (
+ <div className="entity-events-list-container">
+ <div className="entity-events-list-card">
<Table<EventDataType>
loading={isLoading && page > 1}
columns={columns}
@@ -320,7 +327,7 @@ export default function Events({
rowExpandable: (record): boolean => record.body !== 'Not Expandable',
expandIcon: handleExpandRowIcon,
}}
- dataSource={formattedNodeEvents}
+ dataSource={formattedEntityEvents}
pagination={false}
rowKey={(record): string => record.id}
/>
@@ -328,10 +335,10 @@ export default function Events({
</div>
)}
- {!isError && formattedNodeEvents.length > 0 && (
- <div className="node-events-footer">
+ {!isError && formattedEntityEvents.length > 0 && (
+ <div className="entity-events-footer">
<Button
- className="node-events-footer-button periscope-btn ghost"
+ className="entity-events-footer-button periscope-btn ghost"
type="link"
onClick={handlePrev}
disabled={page === 1 || isFetching || isLoading}
@@ -341,7 +348,7 @@ export default function Events({
</Button>
<Button
- className="node-events-footer-button periscope-btn ghost"
+ className="entity-events-footer-button periscope-btn ghost"
type="link"
onClick={handleNext}
disabled={hasReachedEndOfEvents || isFetching || isLoading}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss
similarity index 94%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.styles.scss
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss
index 54ed42d565..a3be71803b 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss
@@ -1,4 +1,5 @@
-.pod-events-container {
+// Events
+.entity-events-container {
margin-top: 1rem;
.filter-section {
@@ -19,7 +20,7 @@
}
}
- .pod-events-header {
+ .entity-events-header {
display: flex;
justify-content: space-between;
gap: 8px;
@@ -29,7 +30,7 @@
border: 1px solid var(--bg-slate-500);
}
- .pod-events {
+ .entity-events {
margin-top: 1rem;
.virtuoso-list {
@@ -87,7 +88,7 @@
}
}
- .ant-table-thead > tr > th:has(.hostname-column-header) {
+ .ant-table-thead > tr > th:has(.entityname-column-header) {
background: var(--bg-ink-400);
}
@@ -100,11 +101,11 @@
border-bottom: none;
}
- .ant-table-cell:has(.hostname-column-value) {
+ .ant-table-cell:has(.entityname-column-value) {
background: var(--bg-ink-400);
}
- .hostname-column-value {
+ .entityname-column-value {
color: var(--bg-vanilla-100);
font-family: 'Geist Mono';
font-style: normal;
@@ -190,7 +191,7 @@
}
}
-.pod-events-list-container {
+.entity-events-list-container {
flex: 1;
height: calc(100vh - 300px) !important;
display: flex;
@@ -203,7 +204,7 @@
}
}
-.pod-events-list-card {
+.entity-events-list-card {
width: 100%;
margin-top: 12px;
@@ -271,7 +272,7 @@
}
}
-.pod-events-footer {
+.entity-events-footer {
display: flex;
justify-content: flex-end;
align-items: center;
@@ -297,7 +298,7 @@
}
.periscope-btn {
- &.ghost {
+ &.gentity {
border: none;
background: transparent;
}
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/index.ts b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/index.ts
new file mode 100644
index 0000000000..01ca4fa6dd
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/index.ts
@@ -0,0 +1,3 @@
+import Events from './EntityEvents';
+
+export default Events;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx
similarity index 81%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.tsx
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx
index c9880228f1..c73865eb80 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx
@@ -1,10 +1,11 @@
/* eslint-disable no-nested-ternary */
-import './NodeLogs.styles.scss';
+import './entityLogs.styles.scss';
import { Card } from 'antd';
import RawLogView from 'components/Logs/RawLogView';
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
import LogsError from 'container/LogsError/LogsError';
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import { FontSize } from 'container/OptionsMenu/types';
@@ -22,9 +23,10 @@ import {
} from 'types/api/queryBuilder/queryBuilderData';
import { v4 } from 'uuid';
-import { QUERY_KEYS } from '../constants';
-import { getNodeLogsQueryPayload } from './constants';
-import NoLogsContainer from './NoLogsContainer';
+import {
+ EntityDetailsEmptyContainer,
+ getEntityEventsOrLogsQueryPayload,
+} from '../utils';
interface Props {
timeRange: {
@@ -33,12 +35,18 @@ interface Props {
};
handleChangeLogFilters: (filters: IBuilderQuery['filters']) => void;
filters: IBuilderQuery['filters'];
+ queryKey: string;
+ category: K8sCategory;
+ queryKeyFilters: Array<string>;
}
-function PodLogs({
+function EntityLogs({
timeRange,
handleChangeLogFilters,
filters,
+ queryKey,
+ category,
+ queryKeyFilters,
}: Props): JSX.Element {
const [logs, setLogs] = useState<ILog[]>([]);
const [hasReachedEndOfLogs, setHasReachedEndOfLogs] = useState(false);
@@ -48,10 +56,7 @@ function PodLogs({
useEffect(() => {
const newRestFilters = filters.items.filter(
(item) =>
- item.key?.key !== 'id' &&
- ![QUERY_KEYS.K8S_NODE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
- item.key?.key ?? '',
- ),
+ item.key?.key !== 'id' && !queryKeyFilters.includes(item.key?.key ?? ''),
);
const areFiltersSame = isEqual(restFilters, newRestFilters);
@@ -65,7 +70,7 @@ function PodLogs({
}, [filters]);
const queryPayload = useMemo(() => {
- const basePayload = getNodeLogsQueryPayload(
+ const basePayload = getEntityEventsOrLogsQueryPayload(
timeRange.startTime,
timeRange.endTime,
filters,
@@ -82,7 +87,7 @@ function PodLogs({
const [isPaginating, setIsPaginating] = useState(false);
const { data, isLoading, isFetching, isError } = useQuery({
- queryKey: ['nodeLogs', timeRange.startTime, timeRange.endTime, filters],
+ queryKey: [queryKey, timeRange.startTime, timeRange.endTime, filters],
queryFn: () => GetMetricQueryRange(queryPayload, DEFAULT_ENTITY_VERSION),
enabled: !!queryPayload,
keepPreviousData: isPaginating,
@@ -127,6 +132,18 @@ function PodLogs({
data={logToRender}
linesPerRow={5}
fontSize={FontSize.MEDIUM}
+ selectedFields={[
+ {
+ dataType: 'string',
+ type: '',
+ name: 'body',
+ },
+ {
+ dataType: 'string',
+ type: '',
+ name: 'timestamp',
+ },
+ ]}
/>
),
[],
@@ -181,11 +198,11 @@ function PodLogs({
const renderContent = useMemo(
() => (
- <Card bordered={false} className="node-logs-list-card">
+ <Card bordered={false} className="entity-logs-list-card">
<OverlayScrollbar isVirtuoso>
<Virtuoso
- className="node-logs-virtuoso"
- key="node-logs-virtuoso"
+ className="entity-logs-virtuoso"
+ key="entity-logs-virtuoso"
data={logs}
endReached={loadMoreLogs}
totalCount={logs.length}
@@ -202,15 +219,17 @@ function PodLogs({
);
return (
- <div className="node-logs">
+ <div className="entity-logs">
{isLoading && <LogsLoading />}
- {!isLoading && !isError && logs.length === 0 && <NoLogsContainer />}
+ {!isLoading && !isError && logs.length === 0 && (
+ <EntityDetailsEmptyContainer category={category} view="logs" />
+ )}
{isError && !isLoading && <LogsError />}
{!isLoading && !isError && logs.length > 0 && (
- <div className="node-logs-list-container">{renderContent}</div>
+ <div className="entity-logs-list-container">{renderContent}</div>
)}
</div>
);
}
-export default PodLogs;
+export default EntityLogs;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogsDetailedView.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
similarity index 81%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogsDetailedView.tsx
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
index 5bbec59ade..bab5c68eb6 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogsDetailedView.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogsDetailedView.tsx
@@ -1,5 +1,6 @@
-import './NodeLogs.styles.scss';
+import './entityLogs.styles.scss';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch';
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
@@ -11,7 +12,7 @@ import { useMemo } from 'react';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
-import NodeLogs from './NodeLogs';
+import EntityLogs from './EntityLogs';
interface Props {
timeRange: {
@@ -26,15 +27,21 @@ interface Props {
handleChangeLogFilters: (value: IBuilderQuery['filters']) => void;
logFilters: IBuilderQuery['filters'];
selectedInterval: Time;
+ queryKey: string;
+ category: K8sCategory;
+ queryKeyFilters: Array<string>;
}
-function NodeLogsDetailedView({
+function EntityLogsDetailedView({
timeRange,
isModalTimeSelection,
handleTimeChange,
handleChangeLogFilters,
logFilters,
selectedInterval,
+ queryKey,
+ category,
+ queryKeyFilters,
}: Props): JSX.Element {
const { currentQuery } = useQueryBuilder();
const updatedCurrentQuery = useMemo(
@@ -64,8 +71,8 @@ function NodeLogsDetailedView({
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
return (
- <div className="node-logs-container">
- <div className="node-logs-header">
+ <div className="entity-logs-container">
+ <div className="entity-logs-header">
<div className="filter-section">
{query && (
<QueryBuilderSearch
@@ -87,13 +94,16 @@ function NodeLogsDetailedView({
/>
</div>
</div>
- <NodeLogs
+ <EntityLogs
timeRange={timeRange}
handleChangeLogFilters={handleChangeLogFilters}
filters={logFilters}
+ queryKey={queryKey}
+ category={category}
+ queryKeyFilters={queryKeyFilters}
/>
</div>
);
}
-export default NodeLogsDetailedView;
+export default EntityLogsDetailedView;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/entityLogs.styles.scss
similarity index 94%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.styles.scss
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/entityLogs.styles.scss
index 71f6b7f3f8..b4c518a319 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NodeLogs.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/entityLogs.styles.scss
@@ -1,4 +1,4 @@
-.node-logs-container {
+.entity-logs-container {
margin-top: 1rem;
.filter-section {
@@ -19,7 +19,7 @@
}
}
- .node-logs-header {
+ .entity-logs-header {
display: flex;
justify-content: space-between;
gap: 8px;
@@ -29,7 +29,7 @@
border: 1px solid var(--bg-slate-500);
}
- .node-logs {
+ .entity-logs {
margin-top: 1rem;
.virtuoso-list {
@@ -64,7 +64,7 @@
}
}
-.node-logs-list-container {
+.entity-logs-list-container {
flex: 1;
height: calc(100vh - 272px) !important;
display: flex;
@@ -77,7 +77,7 @@
}
}
-.node-logs-list-card {
+.entity-logs-list-card {
width: 100%;
margin-top: 12px;
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/index.ts b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/index.ts
new file mode 100644
index 0000000000..5bd0f406d1
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/index.ts
@@ -0,0 +1,3 @@
+import EntityLogs from './EntityLogsDetailedView';
+
+export default EntityLogs;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
similarity index 56%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.tsx
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
index 2135e7b610..b8a8bbe172 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx
@@ -1,10 +1,15 @@
-import './Metrics.styles.scss';
+import './entityMetrics.styles.scss';
import { Card, Col, Row, Skeleton, Typography } from 'antd';
-import { K8sPodsData } from 'api/infraMonitoring/getK8sPodsList';
import cx from 'classnames';
import Uplot from 'components/Uplot';
import { ENTITY_VERSION_V4 } from 'constants/app';
+import { PANEL_TYPES } from 'constants/queryBuilder';
+import {
+ getMetricsTableData,
+ MetricsTable,
+} from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import {
CustomTimeType,
@@ -12,17 +17,19 @@ import {
} from 'container/TopNav/DateTimeSelectionV2/config';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
-import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
+import {
+ GetMetricQueryRange,
+ GetQueryResultsProps,
+} from 'lib/dashboard/getQueryResults';
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
import { useMemo, useRef } from 'react';
import { useQueries, UseQueryResult } from 'react-query';
import { SuccessResponse } from 'types/api';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
+import { Options } from 'uplot';
-import { getPodQueryPayload, podWidgetInfo } from '../../constants';
-
-interface MetricsTabProps {
+interface EntityMetricsProps<T> {
timeRange: {
startTime: number;
endTime: number;
@@ -33,24 +40,39 @@ interface MetricsTabProps {
dateTimeRange?: [number, number],
) => void;
selectedInterval: Time;
- pod: K8sPodsData;
+ entity: T;
+ entityWidgetInfo: {
+ title: string;
+ yAxisUnit: string;
+ }[];
+ getEntityQueryPayload: (
+ node: T,
+ start: number,
+ end: number,
+ ) => GetQueryResultsProps[];
+ queryKey: string;
+ category: K8sCategory;
}
-function Metrics({
+function EntityMetrics<T>({
selectedInterval,
- pod,
+ entity,
timeRange,
handleTimeChange,
isModalTimeSelection,
-}: MetricsTabProps): JSX.Element {
+ entityWidgetInfo,
+ getEntityQueryPayload,
+ queryKey,
+ category,
+}: EntityMetricsProps<T>): JSX.Element {
const queryPayloads = useMemo(
- () => getPodQueryPayload(pod, timeRange.startTime, timeRange.endTime),
- [pod, timeRange.startTime, timeRange.endTime],
+ () => getEntityQueryPayload(entity, timeRange.startTime, timeRange.endTime),
+ [getEntityQueryPayload, entity, timeRange.startTime, timeRange.endTime],
);
const queries = useQueries(
queryPayloads.map((payload) => ({
- queryKey: ['pod-metrics', payload, ENTITY_VERSION_V4, 'POD'],
+ queryKey: [queryKey, payload, ENTITY_VERSION_V4, category],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V4),
enabled: !!payload,
@@ -62,25 +84,42 @@ function Metrics({
const dimensions = useResizeObserver(graphRef);
const chartData = useMemo(
- () => queries.map(({ data }) => getUPlotChartData(data?.payload)),
+ () =>
+ queries.map(({ data }) => {
+ const panelType = (data?.params as any)?.compositeQuery?.panelType;
+ return panelType === PANEL_TYPES.TABLE
+ ? getMetricsTableData(data)
+ : getUPlotChartData(data?.payload);
+ }),
[queries],
);
const options = useMemo(
() =>
- queries.map(({ data }, idx) =>
- getUPlotChartOptions({
+ queries.map(({ data }, idx) => {
+ const panelType = (data?.params as any)?.compositeQuery?.panelType;
+ if (panelType === PANEL_TYPES.TABLE) {
+ return null;
+ }
+ return getUPlotChartOptions({
apiResponse: data?.payload,
isDarkMode,
dimensions,
- yAxisUnit: podWidgetInfo[idx].yAxisUnit,
+ yAxisUnit: entityWidgetInfo[idx].yAxisUnit,
softMax: null,
softMin: null,
minTimeScale: timeRange.startTime,
maxTimeScale: timeRange.endTime,
- }),
- ),
- [queries, isDarkMode, dimensions, timeRange.startTime, timeRange.endTime],
+ });
+ }),
+ [
+ queries,
+ isDarkMode,
+ dimensions,
+ entityWidgetInfo,
+ timeRange.startTime,
+ timeRange.endTime,
+ ],
);
const renderCardContent = (
@@ -96,6 +135,9 @@ function Metrics({
(query.error as Error)?.message || 'Something went wrong';
return <div>{errorMessage}</div>;
}
+
+ const { panelType } = (query.data?.params as any).compositeQuery;
+
return (
<div
className={cx('chart-container', {
@@ -103,7 +145,14 @@ function Metrics({
!query.isLoading && !query?.data?.payload?.data?.result?.length,
})}
>
- <Uplot options={options[idx]} data={chartData[idx]} />
+ {panelType === PANEL_TYPES.TABLE ? (
+ <MetricsTable
+ rows={chartData[idx][0].rows}
+ columns={chartData[idx][0].columns}
+ />
+ ) : (
+ <Uplot options={options[idx] as Options} data={chartData[idx]} />
+ )}
</div>
);
};
@@ -123,11 +172,11 @@ function Metrics({
/>
</div>
</div>
- <Row gutter={24} className="host-metrics-container">
+ <Row gutter={24} className="entity-metrics-container">
{queries.map((query, idx) => (
- <Col span={12} key={podWidgetInfo[idx].title}>
- <Typography.Text>{podWidgetInfo[idx].title}</Typography.Text>
- <Card bordered className="host-metrics-card" ref={graphRef}>
+ <Col span={12} key={entityWidgetInfo[idx].title}>
+ <Typography.Text>{entityWidgetInfo[idx].title}</Typography.Text>
+ <Card bordered className="entity-metrics-card" ref={graphRef}>
{renderCardContent(query, idx)}
</Card>
</Col>
@@ -137,4 +186,4 @@ function Metrics({
);
}
-export default Metrics;
+export default EntityMetrics;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/entityMetrics.styles.scss
similarity index 76%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.styles.scss
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/entityMetrics.styles.scss
index 3978680c09..3af4091b60 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Metrics/Metrics.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/entityMetrics.styles.scss
@@ -1,11 +1,5 @@
-.empty-container {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
-}
-
-.host-metrics-container {
+// Metrics
+.entity-metrics-container {
margin-top: 1rem;
}
@@ -20,7 +14,7 @@
border: 1px solid var(--bg-slate-500);
}
-.host-metrics-card {
+.entity-metrics-card {
margin: 8px 0 1rem 0;
height: 300px;
padding: 10px;
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/index.ts b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/index.ts
new file mode 100644
index 0000000000..71e23e4da9
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/index.ts
@@ -0,0 +1,3 @@
+import EntityMetrics from './EntityMetrics';
+
+export default EntityMetrics;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
similarity index 91%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.tsx
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
index 00e3533f2d..189f047c88 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/EntityTraces.tsx
@@ -1,4 +1,4 @@
-import './NodeTraces.styles.scss';
+import './entityTraces.styles.scss';
import { getListColumns } from 'components/HostMetricsDetail/HostMetricTraces/utils';
import { ResizeTable } from 'components/ResizeTable';
@@ -25,7 +25,10 @@ import { useQuery } from 'react-query';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';
-import { getNodeTracesQueryPayload, selectedColumns } from './constants';
+import {
+ getEntityTracesQueryPayload,
+ selectedEntityTracesColumns,
+} from '../utils';
interface Props {
timeRange: {
@@ -40,15 +43,17 @@ interface Props {
handleChangeTracesFilters: (value: IBuilderQuery['filters']) => void;
tracesFilters: IBuilderQuery['filters'];
selectedInterval: Time;
+ queryKey: string;
}
-function NodeTraces({
+function EntityTraces({
timeRange,
isModalTimeSelection,
handleTimeChange,
handleChangeTracesFilters,
tracesFilters,
selectedInterval,
+ queryKey,
}: Props): JSX.Element {
const [traces, setTraces] = useState<any[]>([]);
const [offset] = useState<number>(0);
@@ -86,7 +91,7 @@ function NodeTraces({
const queryPayload = useMemo(
() =>
- getNodeTracesQueryPayload(
+ getEntityTracesQueryPayload(
timeRange.startTime,
timeRange.endTime,
paginationQueryData?.offset || offset,
@@ -103,7 +108,7 @@ function NodeTraces({
const { data, isLoading, isFetching, isError } = useQuery({
queryKey: [
- 'hostMetricTraces',
+ queryKey,
timeRange.startTime,
timeRange.endTime,
offset,
@@ -115,7 +120,7 @@ function NodeTraces({
enabled: !!queryPayload,
});
- const traceListColumns = getListColumns(selectedColumns);
+ const traceListColumns = getListColumns(selectedEntityTracesColumns);
useEffect(() => {
if (data?.payload?.data?.newResult?.data?.result) {
@@ -138,8 +143,8 @@ function NodeTraces({
data?.payload?.data?.newResult?.data?.result?.[0]?.list?.length || 0;
return (
- <div className="node-metric-traces">
- <div className="node-metric-traces-header">
+ <div className="entity-metric-traces">
+ <div className="entity-metric-traces-header">
<div className="filter-section">
{query && (
<QueryBuilderSearch
@@ -175,7 +180,7 @@ function NodeTraces({
)}
{!isError && traces.length > 0 && (
- <div className="node-traces-table">
+ <div className="entity-traces-table">
<TraceExplorerControls
isLoading={isFetching}
totalCount={totalCount}
@@ -196,4 +201,4 @@ function NodeTraces({
);
}
-export default NodeTraces;
+export default EntityTraces;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/entityTraces.styles.scss
similarity index 88%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.styles.scss
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/entityTraces.styles.scss
index a2d461a3a4..9c90114edc 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/entityTraces.styles.scss
@@ -1,7 +1,8 @@
-.pod-metric-traces {
+// Traces
+.entity-metric-traces {
margin-top: 1rem;
- .pod-metric-traces-header {
+ .entity-metric-traces-header {
display: flex;
justify-content: space-between;
margin-bottom: 1rem;
@@ -30,7 +31,7 @@
}
}
- .pod-metric-traces-table {
+ .entity-metric-traces-table {
.ant-table-content {
overflow: hidden !important;
}
@@ -62,7 +63,7 @@
}
}
- .ant-table-thead > tr > th:has(.hostname-column-header) {
+ .ant-table-thead > tr > th:has(.entityname-column-header) {
background: var(--bg-ink-400);
}
@@ -74,11 +75,11 @@
background: rgba(171, 189, 255, 0.01);
}
- .ant-table-cell:has(.hostname-column-value) {
+ .ant-table-cell:has(.entityname-column-value) {
background: var(--bg-ink-400);
}
- .hostname-column-value {
+ .entityname-column-value {
color: var(--bg-vanilla-100);
font-family: 'Geist Mono';
font-style: normal;
@@ -145,7 +146,7 @@
}
.lightMode {
- .host-metric-traces-header {
+ .entity-metric-traces-header {
.filter-section {
border-top: 1px solid var(--bg-vanilla-300);
border-bottom: 1px solid var(--bg-vanilla-300);
@@ -158,7 +159,7 @@
}
}
- .host-metric-traces-table {
+ .entity-metric-traces-table {
.ant-table {
border-radius: 3px;
border: 1px solid var(--bg-vanilla-300);
@@ -168,7 +169,7 @@
color: var(--text-ink-300);
}
- .ant-table-thead > tr > th:has(.hostname-column-header) {
+ .ant-table-thead > tr > th:has(.entityname-column-header) {
background: var(--bg-vanilla-100);
}
@@ -177,11 +178,11 @@
color: var(--bg-ink-500);
}
- .ant-table-cell:has(.hostname-column-value) {
+ .ant-table-cell:has(.entityname-column-value) {
background: var(--bg-vanilla-100);
}
- .hostname-column-value {
+ .entityname-column-value {
color: var(--bg-ink-300);
}
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/index.ts b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/index.ts
new file mode 100644
index 0000000000..890b543828
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/index.ts
@@ -0,0 +1,3 @@
+import EntityTraces from './EntityTraces';
+
+export default EntityTraces;
diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/entityDetails.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/entityDetails.styles.scss
new file mode 100644
index 0000000000..1fd8c08dab
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/entityDetails.styles.scss
@@ -0,0 +1,576 @@
+// Entity Details
+.entity-detail-drawer {
+ border-left: 1px solid var(--bg-slate-500);
+ background: var(--bg-ink-400);
+ box-shadow: -4px 10px 16px 2px rgba(0, 0, 0, 0.2);
+
+ .ant-drawer-header {
+ padding: 8px 16px;
+ border-bottom: none;
+
+ align-items: stretch;
+
+ border-bottom: 1px solid var(--bg-slate-500);
+ background: var(--bg-ink-400);
+ }
+
+ .ant-drawer-close {
+ margin-inline-end: 0px;
+ }
+
+ .ant-drawer-body {
+ display: flex;
+ flex-direction: column;
+ padding: 16px;
+ }
+
+ .title {
+ color: var(--text-vanilla-400);
+ font-family: 'Geist Mono';
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: 20px; /* 142.857% */
+ letter-spacing: -0.07px;
+ }
+
+ .radio-button {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding-top: var(--padding-1);
+ border: 1px solid var(--bg-slate-400);
+ background: var(--bg-ink-300);
+ box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
+ }
+
+ .entity-detail-drawer__entity {
+ .entity-details-grid {
+ .labels-row,
+ .values-row {
+ display: grid;
+ grid-template-columns: 1fr 1.5fr 1.5fr 1.5fr;
+ gap: 30px;
+ align-items: center;
+ }
+
+ .labels-row {
+ margin-bottom: 8px;
+ }
+
+ .entity-details-metadata-label {
+ color: var(--text-vanilla-400);
+ font-family: Inter;
+ font-size: 11px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: 18px; /* 163.636% */
+ letter-spacing: 0.44px;
+ text-transform: uppercase;
+ }
+
+ .entity-details-metadata-value {
+ color: var(--text-vanilla-400);
+ font-family: 'Geist Mono';
+ font-size: 12px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: 20px; /* 142.857% */
+ letter-spacing: -0.07px;
+
+ width: 100%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .status-tag {
+ margin: 0;
+
+ &.active {
+ color: var(--success-500);
+ background: var(--success-100);
+ border-color: var(--success-500);
+ }
+
+ &.inactive {
+ color: var(--error-500);
+ background: var(--error-100);
+ border-color: var(--error-500);
+ }
+ }
+
+ .progress-container {
+ width: 158px;
+ .ant-progress {
+ margin: 0;
+
+ .ant-progress-text {
+ font-weight: 600;
+ }
+ }
+ }
+
+ .ant-card {
+ &.ant-card-bordered {
+ border: 1px solid var(--bg-slate-500) !important;
+ }
+ }
+ }
+ }
+
+ .tabs-and-search {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin: 16px 0;
+
+ .action-btn {
+ border-radius: 2px;
+ border: 1px solid var(--bg-slate-400);
+ background: var(--bg-ink-300);
+ box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+
+ .views-tabs-container {
+ margin-top: 1.5rem;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .views-tabs {
+ color: var(--text-vanilla-400);
+
+ .view-title {
+ display: flex;
+ gap: var(--margin-2);
+ align-items: center;
+ justify-content: center;
+ font-size: var(--font-size-xs);
+ font-style: normal;
+ font-weight: var(--font-weight-normal);
+ }
+
+ .tab {
+ border: 1px solid var(--bg-slate-400);
+ width: 114px;
+ }
+
+ .tab::before {
+ background: var(--bg-slate-400);
+ }
+
+ .selected_view {
+ background: var(--bg-slate-300);
+ color: var(--text-vanilla-100);
+ border: 1px solid var(--bg-slate-400);
+ }
+
+ .selected_view::before {
+ background: var(--bg-slate-400);
+ }
+ }
+
+ .compass-button {
+ width: 30px;
+ height: 30px;
+
+ border-radius: 2px;
+ border: 1px solid var(--bg-slate-400);
+ background: var(--bg-ink-300);
+ box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
+ }
+ }
+ .ant-drawer-close {
+ padding: 0px;
+ }
+}
+
+.lightMode {
+ .ant-drawer-header {
+ border-bottom: 1px solid var(--bg-vanilla-400);
+ background: var(--bg-vanilla-100);
+ }
+
+ .entity-detail-drawer {
+ .title {
+ color: var(--text-ink-300);
+ }
+
+ .entity-detail-drawer__entity {
+ .ant-typography {
+ color: var(--text-ink-300);
+ background: transparent;
+ }
+ }
+
+ .radio-button {
+ border: 1px solid var(--bg-vanilla-400);
+ background: var(--bg-vanilla-100);
+ color: var(--text-ink-300);
+ }
+
+ .views-tabs {
+ .tab {
+ background: var(--bg-vanilla-100);
+ }
+
+ .selected_view {
+ background: var(--bg-vanilla-300);
+ border: 1px solid var(--bg-slate-300);
+ color: var(--text-ink-400);
+ }
+
+ .selected_view::before {
+ background: var(--bg-vanilla-300);
+ border-left: 1px solid var(--bg-slate-300);
+ }
+ }
+
+ .compass-button {
+ border: 1px solid var(--bg-vanilla-300);
+ background: var(--bg-vanilla-100);
+ box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
+ }
+
+ .tabs-and-search {
+ .action-btn {
+ border: 1px solid var(--bg-vanilla-400);
+ background: var(--bg-vanilla-100);
+ color: var(--text-ink-300);
+ }
+ }
+ }
+}
+
+.entity-metric-traces {
+ margin-top: 1rem;
+
+ .entity-metric-traces-header {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 1rem;
+
+ gap: 8px;
+ padding: 12px;
+ border-radius: 3px;
+ border: 1px solid var(--bg-slate-500);
+
+ .filter-section {
+ flex: 1;
+
+ .ant-select-selector {
+ border-radius: 2px;
+ border: 1px solid var(--bg-slate-400) !important;
+ background-color: var(--bg-ink-300) !important;
+
+ input {
+ font-size: 12px;
+ }
+
+ .ant-tag .ant-typography {
+ font-size: 12px;
+ }
+ }
+ }
+ }
+
+ .entity-metric-traces-table {
+ .ant-table-content {
+ overflow: hidden !important;
+ }
+
+ .ant-table {
+ border-radius: 3px;
+ border: 1px solid var(--bg-slate-500);
+
+ .ant-table-thead > tr > th {
+ padding: 12px;
+ font-weight: 500;
+ font-size: 12px;
+ line-height: 18px;
+
+ background: rgba(171, 189, 255, 0.01);
+ border-bottom: none;
+
+ color: var(--Vanilla-400, #c0c1c3);
+ font-family: Inter;
+ font-size: 11px;
+ font-style: normal;
+ font-weight: 600;
+ line-height: 18px; /* 163.636% */
+ letter-spacing: 0.44px;
+ text-transform: uppercase;
+
+ &::before {
+ background-color: transparent;
+ }
+ }
+
+ .ant-table-thead > tr > th:has(.entityname-column-header) {
+ background: var(--bg-ink-400);
+ }
+
+ .ant-table-cell {
+ padding: 12px;
+ font-size: 13px;
+ line-height: 20px;
+ color: var(--bg-vanilla-100);
+ background: rgba(171, 189, 255, 0.01);
+ }
+
+ .ant-table-cell:has(.entityname-column-value) {
+ background: var(--bg-ink-400);
+ }
+
+ .entityname-column-value {
+ color: var(--bg-vanilla-100);
+ font-family: 'Geist Mono';
+ font-style: normal;
+ font-weight: 600;
+ line-height: 20px; /* 142.857% */
+ letter-spacing: -0.07px;
+ }
+
+ .status-cell {
+ .active-tag {
+ color: var(--bg-forest-500);
+ padding: 4px 8px;
+ border-radius: 4px;
+ font-size: 12px;
+ font-weight: 500;
+ }
+ }
+
+ .progress-container {
+ .ant-progress-bg {
+ height: 8px !important;
+ border-radius: 4px;
+ }
+ }
+
+ .ant-table-tbody > tr:hover > td {
+ background: rgba(255, 255, 255, 0.04);
+ }
+
+ .ant-table-cell:first-child {
+ text-align: justify;
+ }
+
+ .ant-table-cell:nth-child(2) {
+ padding-left: 16px;
+ padding-right: 16px;
+ }
+
+ .ant-table-cell:nth-child(n + 3) {
+ padding-right: 24px;
+ }
+ .column-header-right {
+ text-align: right;
+ }
+ .ant-table-tbody > tr > td {
+ border-bottom: none;
+ }
+
+ .ant-table-thead
+ > tr
+ > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
+ background-color: transparent;
+ }
+
+ .ant-empty-normal {
+ visibility: hidden;
+ }
+ }
+
+ .ant-table-container::after {
+ content: none;
+ }
+ }
+}
+
+.lightMode {
+ .entity-metric-traces-header {
+ .filter-section {
+ border-top: 1px solid var(--bg-vanilla-300);
+ border-bottom: 1px solid var(--bg-vanilla-300);
+
+ .ant-select-selector {
+ border-color: var(--bg-vanilla-300) !important;
+ background-color: var(--bg-vanilla-100) !important;
+ color: var(--bg-ink-200);
+ }
+ }
+ }
+
+ .entity-metric-traces-table {
+ .ant-table {
+ border-radius: 3px;
+ border: 1px solid var(--bg-vanilla-300);
+
+ .ant-table-thead > tr > th {
+ background: var(--bg-vanilla-100);
+ color: var(--text-ink-300);
+ }
+
+ .ant-table-thead > tr > th:has(.entityname-column-header) {
+ background: var(--bg-vanilla-100);
+ }
+
+ .ant-table-cell {
+ background: var(--bg-vanilla-100);
+ color: var(--bg-ink-500);
+ }
+
+ .ant-table-cell:has(.entityname-column-value) {
+ background: var(--bg-vanilla-100);
+ }
+
+ .entityname-column-value {
+ color: var(--bg-ink-300);
+ }
+
+ .ant-table-tbody > tr:hover > td {
+ background: rgba(0, 0, 0, 0.04);
+ }
+ }
+ }
+}
+
+.entity-metrics-logs-container {
+ margin-top: 1rem;
+
+ .filter-section {
+ flex: 1;
+
+ .ant-select-selector {
+ border-radius: 2px;
+ border: 1px solid var(--bg-slate-400) !important;
+ background-color: var(--bg-ink-300) !important;
+
+ input {
+ font-size: 12px;
+ }
+
+ .ant-tag .ant-typography {
+ font-size: 12px;
+ }
+ }
+ }
+
+ .entity-metrics-logs-header {
+ display: flex;
+ justify-content: space-between;
+ gap: 8px;
+
+ padding: 12px;
+ border-radius: 3px;
+ border: 1px solid var(--bg-slate-500);
+ }
+
+ .entity-metrics-logs {
+ margin-top: 1rem;
+
+ .virtuoso-list {
+ overflow-y: hidden !important;
+
+ &::-webkit-scrollbar {
+ width: 0.3rem;
+ height: 0.3rem;
+ }
+
+ &::-webkit-scrollbar-track {
+ background: transparent;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: var(--bg-slate-300);
+ }
+
+ &::-webkit-scrollbar-thumb:hover {
+ background: var(--bg-slate-200);
+ }
+
+ .ant-row {
+ width: fit-content;
+ }
+ }
+
+ .skeleton-container {
+ height: 100%;
+ padding: 16px;
+ }
+ }
+}
+
+.entity-metrics-logs-list-container {
+ flex: 1;
+ height: calc(100vh - 272px) !important;
+ display: flex;
+ height: 100%;
+
+ .raw-log-content {
+ width: 100%;
+ text-wrap: inherit;
+ word-wrap: break-word;
+ }
+}
+
+.entity-metrics-logs-list-card {
+ width: 100%;
+ margin-top: 12px;
+
+ .ant-card-body {
+ padding: 0;
+
+ height: 100%;
+ width: 100%;
+ }
+}
+
+.logs-loading-skeleton {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ padding: 8px 0;
+
+ .ant-skeleton-input-sm {
+ height: 18px;
+ }
+}
+
+.no-logs-found {
+ height: 50vh;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ padding: 24px;
+ box-sizing: border-box;
+
+ .ant-typography {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ }
+}
+
+.lightMode {
+ .filter-section {
+ border-top: 1px solid var(--bg-vanilla-300);
+ border-bottom: 1px solid var(--bg-vanilla-300);
+
+ .ant-select-selector {
+ border-color: var(--bg-vanilla-300) !important;
+ background-color: var(--bg-vanilla-100) !important;
+ color: var(--bg-ink-200);
+ }
+ }
+}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/constants.ts b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/utils.tsx
similarity index 62%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/constants.ts
rename to frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/utils.tsx
index 99c6037177..68c696d586 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/utils.tsx
@@ -1,5 +1,8 @@
+import { Color } from '@signozhq/design-tokens';
+import { Typography } from 'antd';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
+import { Ghost } from 'lucide-react';
import {
BaseAutocompleteData,
DataTypes,
@@ -8,8 +11,105 @@ import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { EQueryType } from 'types/common/dashboard';
import { DataSource } from 'types/common/queryBuilder';
import { nanoToMilli } from 'utils/timeUtils';
+import { v4 as uuidv4 } from 'uuid';
-export const columns = [
+import { K8sCategory } from '../constants';
+
+export const QUERY_KEYS = {
+ K8S_OBJECT_KIND: 'k8s.object.kind',
+ K8S_OBJECT_NAME: 'k8s.object.name',
+ K8S_POD_NAME: 'k8s.pod.name',
+ K8S_NAMESPACE_NAME: 'k8s.namespace.name',
+ K8S_CLUSTER_NAME: 'k8s.cluster.name',
+ K8S_NODE_NAME: 'k8s.node.name',
+ K8S_DEPLOYMENT_NAME: 'k8s.deployment.name',
+};
+
+/**
+ * Returns the payload configuration to fetch events for a K8s entity
+ */
+export const getEntityEventsOrLogsQueryPayload = (
+ start: number,
+ end: number,
+ filters: IBuilderQuery['filters'],
+): GetQueryResultsProps => ({
+ graphType: PANEL_TYPES.LIST,
+ selectedTime: 'GLOBAL_TIME',
+ query: {
+ clickhouse_sql: [],
+ promql: [],
+ builder: {
+ queryData: [
+ {
+ dataSource: DataSource.LOGS,
+ queryName: 'A',
+ aggregateOperator: 'noop',
+ aggregateAttribute: {
+ id: '------false',
+ dataType: DataTypes.String,
+ key: '',
+ isColumn: false,
+ type: '',
+ isJSON: false,
+ },
+ timeAggregation: 'rate',
+ spaceAggregation: 'sum',
+ functions: [],
+ filters,
+ expression: 'A',
+ disabled: false,
+ stepInterval: 60,
+ having: [],
+ limit: null,
+ orderBy: [
+ {
+ columnName: 'timestamp',
+ order: 'desc',
+ },
+ ],
+ groupBy: [],
+ legend: '',
+ reduceTo: 'avg',
+ offset: 0,
+ pageSize: 100,
+ },
+ ],
+ queryFormulas: [],
+ },
+ id: uuidv4(),
+ queryType: EQueryType.QUERY_BUILDER,
+ },
+ params: {
+ lastLogLineTimestamp: null,
+ },
+ start,
+ end,
+});
+
+/**
+ * Empty state container for entity details
+ */
+export function EntityDetailsEmptyContainer({
+ view,
+ category,
+}: {
+ view: 'logs' | 'traces' | 'events';
+ category: K8sCategory;
+}): React.ReactElement {
+ const label = category.slice(0, category.length);
+
+ return (
+ <div className="no-logs-found">
+ <Typography.Text type="secondary">
+ <Ghost size={24} color={Color.BG_AMBER_500} />
+ {`No ${view} found for this ${label}
+ in the selected time range.`}
+ </Typography.Text>
+ </div>
+ );
+}
+
+export const entityTracesColumns = [
{
dataIndex: 'timestamp',
key: 'timestamp',
@@ -50,7 +150,7 @@ export const columns = [
},
];
-export const selectedColumns: BaseAutocompleteData[] = [
+export const selectedEntityTracesColumns: BaseAutocompleteData[] = [
{
key: 'timestamp',
dataType: DataTypes.String,
@@ -89,7 +189,7 @@ export const selectedColumns: BaseAutocompleteData[] = [
},
];
-export const getPodTracesQueryPayload = (
+export const getEntityTracesQueryPayload = (
start: number,
end: number,
offset = 0,
diff --git a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss
index aa2afd0c6b..76ae436183 100644
--- a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss
@@ -876,3 +876,7 @@
}
}
}
+
+.entity-group-header {
+ width: 300px !important;
+}
diff --git a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx
index 40b166fb3f..5ba6995673 100644
--- a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx
@@ -7,16 +7,28 @@ import { Collapse, Tooltip, Typography } from 'antd';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
-import { Container, Workflow } from 'lucide-react';
+import {
+ Boxes,
+ Computer,
+ Container,
+ FilePenLine,
+ Workflow,
+} from 'lucide-react';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import { useState } from 'react';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
+import K8sClustersList from './Clusters/K8sClustersList';
import {
+ ClustersQuickFiltersConfig,
+ DeploymentsQuickFiltersConfig,
K8sCategories,
+ NamespaceQuickFiltersConfig,
NodesQuickFiltersConfig,
PodsQuickFiltersConfig,
} from './constants';
+import K8sDeploymentsList from './Deployments/K8sDeploymentsList';
+import K8sNamespacesList from './Namespaces/K8sNamespacesList';
import K8sNodesList from './Nodes/K8sNodesList';
import K8sPodLists from './Pods/K8sPodLists';
@@ -87,49 +99,49 @@ export default function InfraMonitoringK8s(): JSX.Element {
),
},
// NOTE - Enabled these as we release new entities
- // {
- // label: (
- // <div className="k8s-quick-filters-category-label">
- // <div className="k8s-quick-filters-category-label-container">
- // <FilePenLine
- // size={14}
- // className="k8s-quick-filters-category-label-icon"
- // />
- // <Typography.Text>Namespace</Typography.Text>
- // </div>
- // </div>
- // ),
- // key: K8sCategories.NAMESPACES,
- // showArrow: false,
- // children: (
- // <QuickFilters
- // source="infra-monitoring"
- // config={NamespaceQuickFiltersConfig}
- // handleFilterVisibilityChange={handleFilterVisibilityChange}
- // onFilterChange={handleFilterChange}
- // />
- // ),
- // },
- // {
- // label: (
- // <div className="k8s-quick-filters-category-label">
- // <div className="k8s-quick-filters-category-label-container">
- // <Boxes size={14} className="k8s-quick-filters-category-label-icon" />
- // <Typography.Text>Clusters</Typography.Text>
- // </div>
- // </div>
- // ),
- // key: K8sCategories.CLUSTERS,
- // showArrow: false,
- // children: (
- // <QuickFilters
- // source="infra-monitoring"
- // config={ClustersQuickFiltersConfig}
- // handleFilterVisibilityChange={handleFilterVisibilityChange}
- // onFilterChange={handleFilterChange}
- // />
- // ),
- // },
+ {
+ label: (
+ <div className="k8s-quick-filters-category-label">
+ <div className="k8s-quick-filters-category-label-container">
+ <FilePenLine
+ size={14}
+ className="k8s-quick-filters-category-label-icon"
+ />
+ <Typography.Text>Namespaces</Typography.Text>
+ </div>
+ </div>
+ ),
+ key: K8sCategories.NAMESPACES,
+ showArrow: false,
+ children: (
+ <QuickFilters
+ source="infra-monitoring"
+ config={NamespaceQuickFiltersConfig}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ onFilterChange={handleFilterChange}
+ />
+ ),
+ },
+ {
+ label: (
+ <div className="k8s-quick-filters-category-label">
+ <div className="k8s-quick-filters-category-label-container">
+ <Boxes size={14} className="k8s-quick-filters-category-label-icon" />
+ <Typography.Text>Clusters</Typography.Text>
+ </div>
+ </div>
+ ),
+ key: K8sCategories.CLUSTERS,
+ showArrow: false,
+ children: (
+ <QuickFilters
+ source="infra-monitoring"
+ config={ClustersQuickFiltersConfig}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ onFilterChange={handleFilterChange}
+ />
+ ),
+ },
// {
// label: (
// <div className="k8s-quick-filters-category-label">
@@ -173,26 +185,26 @@ export default function InfraMonitoringK8s(): JSX.Element {
// />
// ),
// },
- // {
- // label: (
- // <div className="k8s-quick-filters-category-label">
- // <div className="k8s-quick-filters-category-label-container">
- // <Computer size={14} className="k8s-quick-filters-category-label-icon" />
- // <Typography.Text>Deployments</Typography.Text>
- // </div>
- // </div>
- // ),
- // key: K8sCategories.DEPLOYMENTS,
- // showArrow: false,
- // children: (
- // <QuickFilters
- // source="infra-monitoring"
- // config={DeploymentsQuickFiltersConfig}
- // handleFilterVisibilityChange={handleFilterVisibilityChange}
- // onFilterChange={handleFilterChange}
- // />
- // ),
- // },
+ {
+ label: (
+ <div className="k8s-quick-filters-category-label">
+ <div className="k8s-quick-filters-category-label-container">
+ <Computer size={14} className="k8s-quick-filters-category-label-icon" />
+ <Typography.Text>Deployments</Typography.Text>
+ </div>
+ </div>
+ ),
+ key: K8sCategories.DEPLOYMENTS,
+ showArrow: false,
+ children: (
+ <QuickFilters
+ source="infra-monitoring"
+ config={DeploymentsQuickFiltersConfig}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ onFilterChange={handleFilterChange}
+ />
+ ),
+ },
// {
// label: (
// <div className="k8s-quick-filters-category-label">
@@ -314,6 +326,30 @@ export default function InfraMonitoringK8s(): JSX.Element {
quickFiltersLastUpdated={quickFiltersLastUpdated}
/>
)}
+
+ {selectedCategory === K8sCategories.DEPLOYMENTS && (
+ <K8sDeploymentsList
+ isFiltersVisible={showFilters}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ quickFiltersLastUpdated={quickFiltersLastUpdated}
+ />
+ )}
+
+ {selectedCategory === K8sCategories.NAMESPACES && (
+ <K8sNamespacesList
+ isFiltersVisible={showFilters}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ quickFiltersLastUpdated={quickFiltersLastUpdated}
+ />
+ )}
+
+ {selectedCategory === K8sCategories.CLUSTERS && (
+ <K8sClustersList
+ isFiltersVisible={showFilters}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ quickFiltersLastUpdated={quickFiltersLastUpdated}
+ />
+ )}
</div>
</div>
</div>
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.styles.scss b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.styles.scss
new file mode 100644
index 0000000000..9181a24e21
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.styles.scss
@@ -0,0 +1,17 @@
+.infra-monitoring-container {
+ .namespaces-list-table {
+ .expanded-table-container {
+ padding-left: 80px;
+ }
+
+ .ant-table-cell {
+ min-width: 223px !important;
+ max-width: 223px !important;
+ }
+
+ .ant-table-row-expand-icon-cell {
+ min-width: 30px !important;
+ max-width: 30px !important;
+ }
+ }
+}
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx
new file mode 100644
index 0000000000..0469bff802
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx
@@ -0,0 +1,512 @@
+/* eslint-disable no-restricted-syntax */
+/* eslint-disable @typescript-eslint/explicit-function-return-type */
+import '../InfraMonitoringK8s.styles.scss';
+import './K8sNamespacesList.styles.scss';
+
+import { LoadingOutlined } from '@ant-design/icons';
+import {
+ Button,
+ Spin,
+ Table,
+ TablePaginationConfig,
+ TableProps,
+ Typography,
+} from 'antd';
+import { ColumnType, SorterResult } from 'antd/es/table/interface';
+import logEvent from 'api/common/logEvent';
+import { K8sNamespacesListPayload } from 'api/infraMonitoring/getK8sNamespacesList';
+import { useGetK8sNamespacesList } from 'hooks/infraMonitoring/useGetK8sNamespacesList';
+import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
+import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
+import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
+import { ChevronDown, ChevronRight } from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { GlobalReducer } from 'types/reducer/globalTime';
+
+import {
+ K8sCategory,
+ K8sEntityToAggregateAttributeMapping,
+} from '../constants';
+import K8sHeader from '../K8sHeader';
+import LoadingContainer from '../LoadingContainer';
+import NamespaceDetails from './NamespaceDetails';
+import {
+ defaultAddedColumns,
+ formatDataForTable,
+ getK8sNamespacesListColumns,
+ getK8sNamespacesListQuery,
+ K8sNamespacesRowData,
+} from './utils';
+
+// eslint-disable-next-line sonarjs/cognitive-complexity
+function K8sNamespacesList({
+ isFiltersVisible,
+ handleFilterVisibilityChange,
+ quickFiltersLastUpdated,
+}: {
+ isFiltersVisible: boolean;
+ handleFilterVisibilityChange: () => void;
+ quickFiltersLastUpdated: number;
+}): JSX.Element {
+ const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
+ (state) => state.globalTime,
+ );
+
+ const [currentPage, setCurrentPage] = useState(1);
+
+ const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
+
+ const [orderBy, setOrderBy] = useState<{
+ columnName: string;
+ order: 'asc' | 'desc';
+ } | null>(null);
+
+ const [selectedNamespaceUID, setselectedNamespaceUID] = useState<
+ string | null
+ >(null);
+
+ const pageSize = 10;
+
+ const [groupBy, setGroupBy] = useState<IBuilderQuery['groupBy']>([]);
+
+ const [
+ selectedRowData,
+ setSelectedRowData,
+ ] = useState<K8sNamespacesRowData | null>(null);
+
+ const [groupByOptions, setGroupByOptions] = useState<
+ { value: string; label: string }[]
+ >([]);
+
+ const { currentQuery } = useQueryBuilder();
+
+ const queryFilters = useMemo(
+ () =>
+ currentQuery?.builder?.queryData[0]?.filters || {
+ items: [],
+ op: 'and',
+ },
+ [currentQuery?.builder?.queryData],
+ );
+
+ // Reset pagination every time quick filters are changed
+ useEffect(() => {
+ setCurrentPage(1);
+ }, [quickFiltersLastUpdated]);
+
+ const createFiltersForSelectedRowData = (
+ selectedRowData: K8sNamespacesRowData,
+ groupBy: IBuilderQuery['groupBy'],
+ ): IBuilderQuery['filters'] => {
+ const baseFilters: IBuilderQuery['filters'] = {
+ items: [...queryFilters.items],
+ op: 'and',
+ };
+
+ if (!selectedRowData) return baseFilters;
+
+ const { groupedByMeta } = selectedRowData;
+
+ for (const key of groupBy) {
+ baseFilters.items.push({
+ key: {
+ key: key.key,
+ type: null,
+ },
+ op: '=',
+ value: groupedByMeta[key.key],
+ id: key.key,
+ });
+ }
+
+ return baseFilters;
+ };
+
+ const fetchGroupedByRowDataQuery = useMemo(() => {
+ if (!selectedRowData) return null;
+
+ const baseQuery = getK8sNamespacesListQuery();
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ return {
+ ...baseQuery,
+ limit: 10,
+ offset: 0,
+ filters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [minTime, maxTime, orderBy, selectedRowData, groupBy]);
+
+ const {
+ data: groupedByRowData,
+ isFetching: isFetchingGroupedByRowData,
+ isLoading: isLoadingGroupedByRowData,
+ isError: isErrorGroupedByRowData,
+ refetch: fetchGroupedByRowData,
+ } = useGetK8sNamespacesList(
+ fetchGroupedByRowDataQuery as K8sNamespacesListPayload,
+ {
+ queryKey: ['namespaceList', fetchGroupedByRowDataQuery],
+ enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData,
+ },
+ );
+
+ const {
+ data: groupByFiltersData,
+ isLoading: isLoadingGroupByFilters,
+ } = useGetAggregateKeys(
+ {
+ dataSource: currentQuery.builder.queryData[0].dataSource,
+ aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.NODES],
+ aggregateOperator: 'noop',
+ searchText: '',
+ tagType: '',
+ },
+ {
+ queryKey: [currentQuery.builder.queryData[0].dataSource, 'noop'],
+ },
+ true,
+ K8sCategory.NODES,
+ );
+
+ const query = useMemo(() => {
+ const baseQuery = getK8sNamespacesListQuery();
+ const queryPayload = {
+ ...baseQuery,
+ limit: pageSize,
+ offset: (currentPage - 1) * pageSize,
+ filters: queryFilters,
+ start: Math.floor(minTime / 1000000),
+ end: Math.floor(maxTime / 1000000),
+ orderBy,
+ };
+ if (groupBy.length > 0) {
+ queryPayload.groupBy = groupBy;
+ }
+ return queryPayload;
+ }, [currentPage, minTime, maxTime, orderBy, groupBy, queryFilters]);
+
+ const formattedGroupedByNamespacesData = useMemo(
+ () =>
+ formatDataForTable(groupedByRowData?.payload?.data?.records || [], groupBy),
+ [groupedByRowData, groupBy],
+ );
+
+ const { data, isFetching, isLoading, isError } = useGetK8sNamespacesList(
+ query as K8sNamespacesListPayload,
+ {
+ queryKey: ['namespaceList', query],
+ enabled: !!query,
+ },
+ );
+
+ const namespacesData = useMemo(() => data?.payload?.data?.records || [], [
+ data,
+ ]);
+ const totalCount = data?.payload?.data?.total || 0;
+
+ const formattedNamespacesData = useMemo(
+ () => formatDataForTable(namespacesData, groupBy),
+ [namespacesData, groupBy],
+ );
+
+ const columns = useMemo(() => getK8sNamespacesListColumns(groupBy), [groupBy]);
+
+ const handleGroupByRowClick = (record: K8sNamespacesRowData): void => {
+ setSelectedRowData(record);
+
+ if (expandedRowKeys.includes(record.key)) {
+ setExpandedRowKeys(expandedRowKeys.filter((key) => key !== record.key));
+ } else {
+ setExpandedRowKeys([record.key]);
+ }
+ };
+
+ useEffect(() => {
+ if (selectedRowData) {
+ fetchGroupedByRowData();
+ }
+ }, [selectedRowData, fetchGroupedByRowData]);
+
+ const handleTableChange: TableProps<K8sNamespacesRowData>['onChange'] = useCallback(
+ (
+ pagination: TablePaginationConfig,
+ _filters: Record<string, (string | number | boolean)[] | null>,
+ sorter:
+ | SorterResult<K8sNamespacesRowData>
+ | SorterResult<K8sNamespacesRowData>[],
+ ): void => {
+ if (pagination.current) {
+ setCurrentPage(pagination.current);
+ }
+
+ if ('field' in sorter && sorter.order) {
+ setOrderBy({
+ columnName: sorter.field as string,
+ order: sorter.order === 'ascend' ? 'asc' : 'desc',
+ });
+ } else {
+ setOrderBy(null);
+ }
+ },
+ [],
+ );
+
+ const { handleChangeQueryData } = useQueryOperations({
+ index: 0,
+ query: currentQuery.builder.queryData[0],
+ entityVersion: '',
+ });
+
+ const handleFiltersChange = useCallback(
+ (value: IBuilderQuery['filters']): void => {
+ handleChangeQueryData('filters', value);
+ setCurrentPage(1);
+
+ logEvent('Infra Monitoring: K8s list filters applied', {
+ filters: value,
+ });
+ },
+ [handleChangeQueryData],
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: K8s list page visited', {});
+ }, []);
+
+ const selectedNamespaceData = useMemo(() => {
+ if (!selectedNamespaceUID) return null;
+ return (
+ namespacesData.find(
+ (namespace) => namespace.namespaceName === selectedNamespaceUID,
+ ) || null
+ );
+ }, [selectedNamespaceUID, namespacesData]);
+
+ const handleRowClick = (record: K8sNamespacesRowData): void => {
+ if (groupBy.length === 0) {
+ setSelectedRowData(null);
+ setselectedNamespaceUID(record.namespaceUID);
+ } else {
+ handleGroupByRowClick(record);
+ }
+
+ logEvent('Infra Monitoring: K8s namespace list item clicked', {
+ namespaceUID: record.namespaceUID,
+ });
+ };
+
+ const nestedColumns = useMemo(() => getK8sNamespacesListColumns([]), []);
+
+ const isGroupedByAttribute = groupBy.length > 0;
+
+ const handleExpandedRowViewAllClick = (): void => {
+ if (!selectedRowData) return;
+
+ const filters = createFiltersForSelectedRowData(selectedRowData, groupBy);
+
+ handleFiltersChange(filters);
+
+ setCurrentPage(1);
+ setSelectedRowData(null);
+ setGroupBy([]);
+ setOrderBy(null);
+ };
+
+ const expandedRowRender = (): JSX.Element => (
+ <div className="expanded-table-container">
+ {isErrorGroupedByRowData && (
+ <Typography>{groupedByRowData?.error || 'Something went wrong'}</Typography>
+ )}
+ {isFetchingGroupedByRowData || isLoadingGroupedByRowData ? (
+ <LoadingContainer />
+ ) : (
+ <div className="expanded-table">
+ <Table
+ columns={nestedColumns as ColumnType<K8sNamespacesRowData>[]}
+ dataSource={formattedGroupedByNamespacesData}
+ pagination={false}
+ scroll={{ x: true }}
+ tableLayout="fixed"
+ size="small"
+ loading={{
+ spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ showHeader={false}
+ />
+
+ {groupedByRowData?.payload?.data?.total &&
+ groupedByRowData?.payload?.data?.total > 10 ? (
+ <div className="expanded-table-footer">
+ <Button
+ type="default"
+ size="small"
+ className="periscope-btn secondary"
+ onClick={handleExpandedRowViewAllClick}
+ >
+ View All
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ );
+
+ const expandRowIconRenderer = ({
+ expanded,
+ onExpand,
+ record,
+ }: {
+ expanded: boolean;
+ onExpand: (
+ record: K8sNamespacesRowData,
+ e: React.MouseEvent<HTMLButtonElement>,
+ ) => void;
+ record: K8sNamespacesRowData;
+ }): JSX.Element | null => {
+ if (!isGroupedByAttribute) {
+ return null;
+ }
+
+ return expanded ? (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronDown size={14} />
+ </Button>
+ ) : (
+ <Button
+ className="periscope-btn ghost"
+ onClick={(e: React.MouseEvent<HTMLButtonElement>): void =>
+ onExpand(record, e)
+ }
+ role="button"
+ >
+ <ChevronRight size={14} />
+ </Button>
+ );
+ };
+
+ const handleCloseNamespaceDetail = (): void => {
+ setselectedNamespaceUID(null);
+ };
+
+ const handleGroupByChange = useCallback(
+ (value: IBuilderQuery['groupBy']) => {
+ const groupBy = [];
+
+ for (let index = 0; index < value.length; index++) {
+ const element = (value[index] as unknown) as string;
+
+ const key = groupByFiltersData?.payload?.attributeKeys?.find(
+ (key) => key.key === element,
+ );
+
+ if (key) {
+ groupBy.push(key);
+ }
+ }
+
+ // Reset pagination on switching to groupBy
+ setCurrentPage(1);
+ setGroupBy(groupBy);
+ setExpandedRowKeys([]);
+ },
+ [groupByFiltersData],
+ );
+
+ useEffect(() => {
+ if (groupByFiltersData?.payload) {
+ setGroupByOptions(
+ groupByFiltersData?.payload?.attributeKeys?.map((filter) => ({
+ value: filter.key,
+ label: filter.key,
+ })) || [],
+ );
+ }
+ }, [groupByFiltersData]);
+
+ return (
+ <div className="k8s-list">
+ <K8sHeader
+ isFiltersVisible={isFiltersVisible}
+ handleFilterVisibilityChange={handleFilterVisibilityChange}
+ defaultAddedColumns={defaultAddedColumns}
+ handleFiltersChange={handleFiltersChange}
+ groupByOptions={groupByOptions}
+ isLoadingGroupByFilters={isLoadingGroupByFilters}
+ handleGroupByChange={handleGroupByChange}
+ selectedGroupBy={groupBy}
+ entity={K8sCategory.NODES}
+ />
+ {isError && <Typography>{data?.error || 'Something went wrong'}</Typography>}
+
+ <Table
+ className="k8s-list-table namespaces-list-table"
+ dataSource={isFetching || isLoading ? [] : formattedNamespacesData}
+ columns={columns}
+ pagination={{
+ current: currentPage,
+ pageSize,
+ total: totalCount,
+ showSizeChanger: false,
+ hideOnSinglePage: true,
+ }}
+ scroll={{ x: true }}
+ loading={{
+ spinning: isFetching || isLoading,
+ indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
+ }}
+ locale={{
+ emptyText:
+ isFetching || isLoading ? null : (
+ <div className="no-filtered-hosts-message-container">
+ <div className="no-filtered-hosts-message-content">
+ <img
+ src="/Icons/emptyState.svg"
+ alt="thinking-emoji"
+ className="empty-state-svg"
+ />
+
+ <Typography.Text className="no-filtered-hosts-message">
+ This query had no results. Edit your query and try again!
+ </Typography.Text>
+ </div>
+ </div>
+ ),
+ }}
+ tableLayout="fixed"
+ onChange={handleTableChange}
+ onRow={(record): { onClick: () => void; className: string } => ({
+ onClick: (): void => handleRowClick(record),
+ className: 'clickable-row',
+ })}
+ expandable={{
+ expandedRowRender: isGroupedByAttribute ? expandedRowRender : undefined,
+ expandIcon: expandRowIconRenderer,
+ expandedRowKeys,
+ }}
+ />
+ <NamespaceDetails
+ namespace={selectedNamespaceData}
+ isModalTimeSelection
+ onClose={handleCloseNamespaceDetail}
+ />
+ </div>
+ );
+}
+
+export default K8sNamespacesList;
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.interfaces.ts b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.interfaces.ts
new file mode 100644
index 0000000000..d24c992bfc
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.interfaces.ts
@@ -0,0 +1,7 @@
+import { K8sNamespacesData } from 'api/infraMonitoring/getK8sNamespacesList';
+
+export type NamespaceDetailsProps = {
+ namespace: K8sNamespacesData | null;
+ isModalTimeSelection: boolean;
+ onClose: () => void;
+};
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.styles.scss b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.styles.scss
similarity index 95%
rename from frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.styles.scss
rename to frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.styles.scss
index 5c2446014e..caad387e4b 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.styles.scss
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.styles.scss
@@ -1,4 +1,4 @@
-.pod-detail-drawer {
+.namespace-detail-drawer {
border-left: 1px solid var(--bg-slate-500);
background: var(--bg-ink-400);
box-shadow: -4px 10px 16px 2px rgba(0, 0, 0, 0.2);
@@ -43,8 +43,8 @@
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
}
- .pod-detail-drawer__pod {
- .pod-details-grid {
+ .namespace-detail-drawer__namespace {
+ .namespace-details-grid {
.labels-row,
.values-row {
display: grid;
@@ -57,7 +57,7 @@
margin-bottom: 8px;
}
- .pod-details-metadata-label {
+ .namespace-details-metadata-label {
color: var(--text-vanilla-400);
font-family: Inter;
font-size: 11px;
@@ -68,7 +68,7 @@
text-transform: uppercase;
}
- .pod-details-metadata-value {
+ .namespace-details-metadata-value {
color: var(--text-vanilla-400);
font-family: 'Geist Mono';
font-size: 12px;
@@ -195,12 +195,12 @@
background: var(--bg-vanilla-100);
}
- .pod-detail-drawer {
+ .namespace-detail-drawer {
.title {
color: var(--text-ink-300);
}
- .pod-detail-drawer__pod {
+ .namespace-detail-drawer__namespace {
.ant-typography {
color: var(--text-ink-300);
background: transparent;
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx
new file mode 100644
index 0000000000..82b181455f
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/NamespaceDetails.tsx
@@ -0,0 +1,566 @@
+/* eslint-disable sonarjs/no-identical-functions */
+import './NamespaceDetails.styles.scss';
+
+import { Color, Spacing } from '@signozhq/design-tokens';
+import { Button, Divider, Drawer, Radio, Tooltip, Typography } from 'antd';
+import { RadioChangeEvent } from 'antd/lib';
+import logEvent from 'api/common/logEvent';
+import { K8sNamespacesData } from 'api/infraMonitoring/getK8sNamespacesList';
+import { VIEW_TYPES, VIEWS } from 'components/HostMetricsDetail/constants';
+import { QueryParams } from 'constants/query';
+import {
+ initialQueryBuilderFormValuesMap,
+ initialQueryState,
+} from 'constants/queryBuilder';
+import ROUTES from 'constants/routes';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
+import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/utils';
+import {
+ CustomTimeType,
+ Time,
+} from 'container/TopNav/DateTimeSelectionV2/config';
+import { useIsDarkMode } from 'hooks/useDarkMode';
+import useUrlQuery from 'hooks/useUrlQuery';
+import GetMinMax from 'lib/getMinMax';
+import {
+ BarChart2,
+ ChevronsLeftRight,
+ Compass,
+ DraftingCompass,
+ ScrollText,
+ X,
+} from 'lucide-react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useSelector } from 'react-redux';
+import { AppState } from 'store/reducers';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import {
+ IBuilderQuery,
+ TagFilterItem,
+} from 'types/api/queryBuilder/queryBuilderData';
+import {
+ LogsAggregatorOperator,
+ TracesAggregatorOperator,
+} from 'types/common/queryBuilder';
+import { GlobalReducer } from 'types/reducer/globalTime';
+import { v4 as uuidv4 } from 'uuid';
+
+import NamespaceEvents from '../../EntityDetailsUtils/EntityEvents';
+import NamespaceLogs from '../../EntityDetailsUtils/EntityLogs';
+import NamespaceMetrics from '../../EntityDetailsUtils/EntityMetrics';
+import NamespaceTraces from '../../EntityDetailsUtils/EntityTraces';
+import {
+ getNamespaceMetricsQueryPayload,
+ namespaceWidgetInfo,
+} from './constants';
+import { NamespaceDetailsProps } from './NamespaceDetails.interfaces';
+
+function NamespaceDetails({
+ namespace,
+ onClose,
+ isModalTimeSelection,
+}: NamespaceDetailsProps): JSX.Element {
+ const { maxTime, minTime, selectedTime } = useSelector<
+ AppState,
+ GlobalReducer
+ >((state) => state.globalTime);
+
+ const startMs = useMemo(() => Math.floor(Number(minTime) / 1000000000), [
+ minTime,
+ ]);
+ const endMs = useMemo(() => Math.floor(Number(maxTime) / 1000000000), [
+ maxTime,
+ ]);
+
+ const urlQuery = useUrlQuery();
+
+ const [modalTimeRange, setModalTimeRange] = useState(() => ({
+ startTime: startMs,
+ endTime: endMs,
+ }));
+
+ const [selectedInterval, setSelectedInterval] = useState<Time>(
+ selectedTime as Time,
+ );
+
+ const [selectedView, setSelectedView] = useState<VIEWS>(VIEWS.METRICS);
+ const isDarkMode = useIsDarkMode();
+
+ const initialFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_NAMESPACE_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s_namespace_name--string--resource--false',
+ },
+ op: '=',
+ value: namespace?.namespaceName || '',
+ },
+ ],
+ }),
+ [namespace?.namespaceName],
+ );
+
+ const initialEventsFilters = useMemo(
+ () => ({
+ op: 'AND',
+ items: [
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_KIND,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.kind--string--resource--false',
+ },
+ op: '=',
+ value: 'Namespace',
+ },
+ {
+ id: uuidv4(),
+ key: {
+ key: QUERY_KEYS.K8S_OBJECT_NAME,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ id: 'k8s.object.name--string--resource--false',
+ },
+ op: '=',
+ value: namespace?.namespaceName || '',
+ },
+ ],
+ }),
+ [namespace?.namespaceName],
+ );
+
+ const [logFilters, setLogFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [tracesFilters, setTracesFilters] = useState<IBuilderQuery['filters']>(
+ initialFilters,
+ );
+
+ const [eventsFilters, setEventsFilters] = useState<IBuilderQuery['filters']>(
+ initialEventsFilters,
+ );
+
+ useEffect(() => {
+ logEvent('Infra Monitoring: Namespaces list details page visited', {
+ namespace: namespace?.namespaceName,
+ });
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ useEffect(() => {
+ setLogFilters(initialFilters);
+ setTracesFilters(initialFilters);
+ setEventsFilters(initialEventsFilters);
+ }, [initialFilters, initialEventsFilters]);
+
+ useEffect(() => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ }, [selectedTime, minTime, maxTime]);
+
+ const handleTabChange = (e: RadioChangeEvent): void => {
+ setSelectedView(e.target.value);
+ };
+
+ const handleTimeChange = useCallback(
+ (interval: Time | CustomTimeType, dateTimeRange?: [number, number]): void => {
+ setSelectedInterval(interval as Time);
+
+ if (interval === 'custom' && dateTimeRange) {
+ setModalTimeRange({
+ startTime: Math.floor(dateTimeRange[0] / 1000),
+ endTime: Math.floor(dateTimeRange[1] / 1000),
+ });
+ } else {
+ const { maxTime, minTime } = GetMinMax(interval);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+
+ logEvent('Infra Monitoring: Namespaces list details time updated', {
+ namespace: namespace?.namespaceName,
+ interval,
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeLogFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setLogFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_NAMESPACE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
+ item.key?.key ?? '',
+ ),
+ );
+ const paginationFilter = value.items.find((item) => item.key?.key === 'id');
+ const newFilters = value.items.filter(
+ (item) =>
+ item.key?.key !== 'id' && item.key?.key !== QUERY_KEYS.K8S_NAMESPACE_NAME,
+ );
+
+ logEvent('Infra Monitoring: Namespaces list details logs filters applied', {
+ namespace: namespace?.namespaceName,
+ });
+
+ return {
+ op: 'AND',
+ items: [
+ ...primaryFilters,
+ ...newFilters,
+ ...(paginationFilter ? [paginationFilter] : []),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeTracesFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setTracesFilters((prevFilters) => {
+ const primaryFilters = prevFilters.items.filter((item) =>
+ [QUERY_KEYS.K8S_NAMESPACE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME].includes(
+ item.key?.key ?? '',
+ ),
+ );
+
+ logEvent(
+ 'Infra Monitoring: Namespaces list details traces filters applied',
+ {
+ namespace: namespace?.namespaceName,
+ },
+ );
+
+ return {
+ op: 'AND',
+ items: [
+ ...primaryFilters,
+ ...value.items.filter(
+ (item) => item.key?.key !== QUERY_KEYS.K8S_NAMESPACE_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleChangeEventsFilters = useCallback(
+ (value: IBuilderQuery['filters']) => {
+ setEventsFilters((prevFilters) => {
+ const namespaceKindFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_KIND,
+ );
+ const namespaceNameFilter = prevFilters.items.find(
+ (item) => item.key?.key === QUERY_KEYS.K8S_OBJECT_NAME,
+ );
+
+ logEvent(
+ 'Infra Monitoring: Namespaces list details events filters applied',
+ {
+ namespace: namespace?.namespaceName,
+ },
+ );
+
+ return {
+ op: 'AND',
+ items: [
+ namespaceKindFilter,
+ namespaceNameFilter,
+ ...value.items.filter(
+ (item) =>
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_KIND &&
+ item.key?.key !== QUERY_KEYS.K8S_OBJECT_NAME,
+ ),
+ ].filter((item): item is TagFilterItem => item !== undefined),
+ };
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [],
+ );
+
+ const handleExplorePagesRedirect = (): void => {
+ if (selectedInterval !== 'custom') {
+ urlQuery.set(QueryParams.relativeTime, selectedInterval);
+ } else {
+ urlQuery.delete(QueryParams.relativeTime);
+ urlQuery.set(QueryParams.startTime, modalTimeRange.startTime.toString());
+ urlQuery.set(QueryParams.endTime, modalTimeRange.endTime.toString());
+ }
+
+ logEvent('Infra Monitoring: Namespaces list details explore clicked', {
+ namespace: namespace?.namespaceName,
+ view: selectedView,
+ });
+
+ if (selectedView === VIEW_TYPES.LOGS) {
+ const filtersWithoutPagination = {
+ ...logFilters,
+ items: logFilters.items.filter((item) => item.key?.key !== 'id'),
+ };
+
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.logs,
+ aggregateOperator: LogsAggregatorOperator.NOOP,
+ filters: filtersWithoutPagination,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.LOGS_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ } else if (selectedView === VIEW_TYPES.TRACES) {
+ const compositeQuery = {
+ ...initialQueryState,
+ queryType: 'builder',
+ builder: {
+ ...initialQueryState.builder,
+ queryData: [
+ {
+ ...initialQueryBuilderFormValuesMap.traces,
+ aggregateOperator: TracesAggregatorOperator.NOOP,
+ filters: tracesFilters,
+ },
+ ],
+ },
+ };
+
+ urlQuery.set('compositeQuery', JSON.stringify(compositeQuery));
+
+ window.open(
+ `${window.location.origin}${ROUTES.TRACES_EXPLORER}?${urlQuery.toString()}`,
+ '_blank',
+ );
+ }
+ };
+
+ const handleClose = (): void => {
+ setSelectedInterval(selectedTime as Time);
+
+ if (selectedTime !== 'custom') {
+ const { maxTime, minTime } = GetMinMax(selectedTime);
+
+ setModalTimeRange({
+ startTime: Math.floor(minTime / 1000000000),
+ endTime: Math.floor(maxTime / 1000000000),
+ });
+ }
+ setSelectedView(VIEW_TYPES.METRICS);
+ onClose();
+ };
+
+ return (
+ <Drawer
+ width="70%"
+ title={
+ <>
+ <Divider type="vertical" />
+ <Typography.Text className="title">
+ {namespace?.namespaceName}
+ </Typography.Text>
+ </>
+ }
+ placement="right"
+ onClose={handleClose}
+ open={!!namespace}
+ style={{
+ overscrollBehavior: 'contain',
+ background: isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100,
+ }}
+ className="entity-detail-drawer"
+ destroyOnClose
+ closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
+ >
+ {namespace && (
+ <>
+ <div className="entity-detail-drawer__entity">
+ <div className="entity-details-grid">
+ <div className="labels-row">
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Namespace Name
+ </Typography.Text>
+ <Typography.Text
+ type="secondary"
+ className="entity-details-metadata-label"
+ >
+ Cluster Name
+ </Typography.Text>
+ </div>
+ <div className="values-row">
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title={namespace.namespaceName}>
+ {namespace.namespaceName}
+ </Tooltip>
+ </Typography.Text>
+ <Typography.Text className="entity-details-metadata-value">
+ <Tooltip title="Cluster name">
+ {namespace.meta.k8s_cluster_name}
+ </Tooltip>
+ </Typography.Text>
+ </div>
+ </div>
+ </div>
+
+ <div className="views-tabs-container">
+ <Radio.Group
+ className="views-tabs"
+ onChange={handleTabChange}
+ value={selectedView}
+ >
+ <Radio.Button
+ className={
+ // eslint-disable-next-line sonarjs/no-duplicate-string
+ selectedView === VIEW_TYPES.METRICS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.METRICS}
+ >
+ <div className="view-title">
+ <BarChart2 size={14} />
+ Metrics
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.LOGS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.LOGS}
+ >
+ <div className="view-title">
+ <ScrollText size={14} />
+ Logs
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.TRACES ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.TRACES}
+ >
+ <div className="view-title">
+ <DraftingCompass size={14} />
+ Traces
+ </div>
+ </Radio.Button>
+ <Radio.Button
+ className={
+ selectedView === VIEW_TYPES.EVENTS ? 'selected_view tab' : 'tab'
+ }
+ value={VIEW_TYPES.EVENTS}
+ >
+ <div className="view-title">
+ <ChevronsLeftRight size={14} />
+ Events
+ </div>
+ </Radio.Button>
+ </Radio.Group>
+
+ {(selectedView === VIEW_TYPES.LOGS ||
+ selectedView === VIEW_TYPES.TRACES) && (
+ <Button
+ icon={<Compass size={18} />}
+ className="compass-button"
+ onClick={handleExplorePagesRedirect}
+ />
+ )}
+ </div>
+ {selectedView === VIEW_TYPES.METRICS && (
+ <NamespaceMetrics<K8sNamespacesData>
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ entity={namespace}
+ entityWidgetInfo={namespaceWidgetInfo}
+ getEntityQueryPayload={getNamespaceMetricsQueryPayload}
+ category={K8sCategory.NAMESPACES}
+ queryKey="namespaceMetrics"
+ />
+ )}
+ {selectedView === VIEW_TYPES.LOGS && (
+ <NamespaceLogs
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeLogFilters={handleChangeLogFilters}
+ logFilters={logFilters}
+ selectedInterval={selectedInterval}
+ queryKey="namespaceLogs"
+ category={K8sCategory.NAMESPACES}
+ queryKeyFilters={[QUERY_KEYS.K8S_NAMESPACE_NAME]}
+ />
+ )}
+ {selectedView === VIEW_TYPES.TRACES && (
+ <NamespaceTraces
+ timeRange={modalTimeRange}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ handleChangeTracesFilters={handleChangeTracesFilters}
+ tracesFilters={tracesFilters}
+ selectedInterval={selectedInterval}
+ queryKey="namespaceTraces"
+ />
+ )}
+ {selectedView === VIEW_TYPES.EVENTS && (
+ <NamespaceEvents
+ timeRange={modalTimeRange}
+ handleChangeEventFilters={handleChangeEventsFilters}
+ filters={eventsFilters}
+ isModalTimeSelection={isModalTimeSelection}
+ handleTimeChange={handleTimeChange}
+ selectedInterval={selectedInterval}
+ category={K8sCategory.NAMESPACES}
+ queryKey="namespaceEvents"
+ />
+ )}
+ </>
+ )}
+ </Drawer>
+ );
+}
+
+export default NamespaceDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/constants.ts b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts
similarity index 69%
rename from frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/constants.ts
rename to frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts
index 47a3f508b4..f7b32c5e65 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts
@@ -1,5 +1,5 @@
/* eslint-disable sonarjs/no-duplicate-string */
-import { K8sNodesData } from 'api/infraMonitoring/getK8sNodesList';
+import { K8sNamespacesData } from 'api/infraMonitoring/getK8sNamespacesList';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
@@ -7,7 +7,7 @@ import { EQueryType } from 'types/common/dashboard';
import { DataSource } from 'types/common/queryBuilder';
import { v4 } from 'uuid';
-export const nodeWidgetInfo = [
+export const namespaceWidgetInfo = [
{
title: 'CPU Usage (cores)',
yAxisUnit: '',
@@ -17,41 +17,41 @@ export const nodeWidgetInfo = [
yAxisUnit: 'bytes',
},
{
- title: 'CPU Usage (%)',
- yAxisUnit: 'percentunit',
+ title: 'Pods CPU (top 10)',
+ yAxisUnit: '',
},
{
- title: 'Memory Usage (%)',
- yAxisUnit: 'percentunit',
+ title: 'Pods Memory (top 10)',
+ yAxisUnit: 'bytes',
},
{
- title: 'Pods by CPU (top 10)',
- yAxisUnit: '',
+ title: 'Network rate',
+ yAxisUnit: 'binBps',
},
{
- title: 'Pods by Memory (top 10)',
- yAxisUnit: 'bytes',
+ title: 'Network errors',
+ yAxisUnit: '',
},
{
- title: 'Network error count',
+ title: 'StatefulSets',
yAxisUnit: '',
},
{
- title: 'Network IO rate',
- yAxisUnit: 'binBps',
+ title: 'ReplicaSets',
+ yAxisUnit: '',
},
{
- title: 'Filesystem usage (bytes)',
- yAxisUnit: 'bytes',
+ title: 'DaemonSets',
+ yAxisUnit: '',
},
{
- title: 'Filesystem usage (%)',
- yAxisUnit: 'percentunit',
+ title: 'Deployments',
+ yAxisUnit: '',
},
];
-export const getNodeQueryPayload = (
- node: K8sNodesData,
+export const getNamespaceMetricsQueryPayload = (
+ namespace: K8sNamespacesData,
start: number,
end: number,
): GetQueryResultsProps[] => [
@@ -64,10 +64,10 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ id: 'k8s_pod_cpu_utilization--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_cpu_utilization',
+ key: 'k8s_pod_cpu_utilization',
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -77,17 +77,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: '441b62d7',
+ id: '47b3adae',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -95,7 +95,7 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'used (avg)',
+ legend: 'usage (avg)',
limit: null,
orderBy: [],
queryName: 'A',
@@ -107,10 +107,10 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
+ id: 'k8s_container_cpu_request--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_allocatable_cpu',
+ key: 'k8s_container_cpu_request',
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -120,17 +120,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: 'b205b1a3',
+ id: '93d2be5e',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -138,42 +138,42 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'allocatable',
+ legend: 'requests',
limit: null,
orderBy: [],
queryName: 'B',
reduceTo: 'avg',
- spaceAggregation: 'max',
+ spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'latest',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_container_cpu_request--float64--Gauge--true',
+ id: 'k8s_pod_cpu_utilization--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_container_cpu_request',
+ key: 'k8s_pod_cpu_utilization',
type: 'Gauge',
},
- aggregateOperator: 'latest',
+ aggregateOperator: 'min',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'C',
filters: {
items: [
{
- id: '884c2bf3',
+ id: '795eb679',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -181,22 +181,22 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'requests',
+ legend: 'usage (min)',
limit: null,
orderBy: [],
queryName: 'C',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'latest',
+ timeAggregation: 'min',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ id: 'k8s_pod_cpu_utilization--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_cpu_utilization',
+ key: 'k8s_pod_cpu_utilization',
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -206,17 +206,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: '98be9da1',
+ id: '6792adbe',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -224,7 +224,7 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'used (max)',
+ legend: 'usage (max)',
limit: null,
orderBy: [],
queryName: 'D',
@@ -233,49 +233,6 @@ export const getNodeQueryPayload = (
stepInterval: 60,
timeAggregation: 'max',
},
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_node_cpu_utilization--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_node_cpu_utilization',
- type: 'Gauge',
- },
- aggregateOperator: 'min',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'E',
- filters: {
- items: [
- {
- id: 'ce97dd7b',
- key: {
- dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'k8s_node_name',
- type: 'tag',
- },
- op: '=',
- value: node.meta.k8s_node_name,
- },
- ],
- op: 'AND',
- },
- functions: [],
- groupBy: [],
- having: [],
- legend: 'used (min)',
- limit: null,
- orderBy: [],
- queryName: 'E',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'min',
- },
],
queryFormulas: [],
},
@@ -312,10 +269,10 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_memory_usage--float64--Gauge--true',
+ id: 'k8s_pod_memory_usage--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_usage',
+ key: 'k8s_pod_memory_usage',
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -325,17 +282,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: 'fdffcbb2',
+ id: '10011298',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -343,7 +300,7 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'used (avg)',
+ legend: 'usage (avg)',
limit: null,
orderBy: [],
queryName: 'A',
@@ -355,10 +312,10 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_allocatable_memory--float64--Gauge--true',
+ id: 'k8s_container_memory_request--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_allocatable_memory',
+ key: 'k8s_container_memory_request',
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -368,17 +325,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: '9b79a8bd',
+ id: 'ea53b656',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -386,42 +343,42 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'allocatable',
+ legend: 'request',
limit: null,
orderBy: [],
queryName: 'B',
reduceTo: 'avg',
- spaceAggregation: 'max',
+ spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'latest',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_container_memory_request--float64--Gauge--true',
+ id: 'k8s_pod_memory_working_set--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_container_memory_request',
+ key: 'k8s_pod_memory_working_set',
type: 'Gauge',
},
- aggregateOperator: 'latest',
+ aggregateOperator: 'avg',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'C',
filters: {
items: [
{
- id: '3387fb4a',
+ id: '674ace83',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -429,42 +386,42 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'requests',
+ legend: 'working set',
limit: null,
orderBy: [],
queryName: 'C',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'latest',
+ timeAggregation: 'avg',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_memory_usage--float64--Gauge--true',
+ id: 'k8s_pod_memory_rss--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_usage',
+ key: 'k8s_pod_memory_rss',
type: 'Gauge',
},
- aggregateOperator: 'max',
+ aggregateOperator: 'avg',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'D',
filters: {
items: [
{
- id: 'd1ad7ccb',
+ id: '187dbdb3',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -472,22 +429,22 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'used (max)',
+ legend: 'rss',
limit: null,
orderBy: [],
queryName: 'D',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'max',
+ timeAggregation: 'avg',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_memory_usage--float64--Gauge--true',
+ id: 'k8s_pod_memory_usage--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_usage',
+ key: 'k8s_pod_memory_usage',
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -497,17 +454,17 @@ export const getNodeQueryPayload = (
filters: {
items: [
{
- id: '5e578329',
+ id: 'a3dbf468',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -515,7 +472,7 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'used (min)',
+ legend: 'usage (min)',
limit: null,
orderBy: [],
queryName: 'E',
@@ -527,30 +484,30 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_memory_working_set--float64--Gauge--true',
+ id: 'k8s_pod_memory_usage--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_working_set',
+ key: 'k8s_pod_memory_usage',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'max',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'F',
filters: {
items: [
{
- id: '6ab3ec98',
+ id: '4b2406c2',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -558,53 +515,95 @@ export const getNodeQueryPayload = (
functions: [],
groupBy: [],
having: [],
- legend: 'working set',
+ legend: 'usage (max)',
limit: null,
orderBy: [],
queryName: 'F',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'max',
},
+ ],
+ 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_node_memory_rss--float64--Gauge--true',
+ id: 'k8s_pod_cpu_utilization--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_rss',
+ key: 'k8s_pod_cpu_utilization',
type: 'Gauge',
},
aggregateOperator: 'avg',
dataSource: DataSource.METRICS,
disabled: false,
- expression: 'G',
+ expression: 'A',
filters: {
items: [
{
- id: '80c9a1db',
+ id: 'c3a73f0a',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'rss',
- limit: null,
+ legend: '{{k8s_pod_name}}',
+ limit: 20,
orderBy: [],
- queryName: 'G',
+ queryName: 'A',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
@@ -646,39 +645,48 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ id: 'k8s_pod_memory_usage--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_cpu_utilization',
+ key: 'k8s_pod_memory_usage',
type: 'Gauge',
},
aggregateOperator: 'avg',
dataSource: DataSource.METRICS,
- disabled: true,
+ disabled: false,
expression: 'A',
filters: {
items: [
{
- id: '752765ef',
+ id: '5cad3379',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'used',
- limit: null,
+ legend: '{{k8s_pod_name}}',
+ limit: 10,
orderBy: [],
queryName: 'A',
reduceTo: 'avg',
@@ -686,107 +694,8 @@ export const getNodeQueryPayload = (
stepInterval: 60,
timeAggregation: 'avg',
},
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_node_allocatable_cpu',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'B',
- filters: {
- items: [
- {
- id: 'f0c5c1ed',
- key: {
- dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'k8s_node_name',
- type: 'tag',
- },
- op: '=',
- value: node.meta.k8s_node_name,
- },
- ],
- op: 'AND',
- },
- functions: [],
- groupBy: [],
- having: [],
- legend: 'allocatable',
- limit: null,
- orderBy: [],
- queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'max',
- stepInterval: 60,
- timeAggregation: 'latest',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_container_cpu_request--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_container_cpu_request',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'C',
- filters: {
- items: [
- {
- id: 'b952b389',
- key: {
- dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'k8s_node_name',
- type: 'tag',
- },
- op: '=',
- value: node.meta.k8s_node_name,
- },
- ],
- op: 'AND',
- },
- functions: [],
- groupBy: [],
- having: [],
- legend: 'requests',
- limit: null,
- orderBy: [],
- queryName: 'C',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'latest',
- },
- ],
- queryFormulas: [
- {
- disabled: false,
- expression: 'A/B',
- legend: 'used/allocatable',
- queryName: 'F1',
- },
- {
- disabled: false,
- expression: 'A/C',
- legend: 'used/request',
- queryName: 'F2',
- },
],
+ queryFormulas: [],
},
clickhouse_sql: [
{
@@ -821,147 +730,65 @@ export const getNodeQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_memory_usage--float64--Gauge--true',
+ id: 'k8s_pod_network_io--float64--Sum--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_memory_usage',
- type: 'Gauge',
+ key: 'k8s_pod_network_io',
+ type: 'Sum',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'rate',
dataSource: DataSource.METRICS,
- disabled: true,
+ disabled: false,
expression: 'A',
filters: {
items: [
{
- id: 'c2a2c926',
+ id: '00f5c5e1',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
- having: [],
- legend: 'used',
- limit: null,
- orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_node_allocatable_memory--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_node_allocatable_memory',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'B',
- filters: {
- items: [
- {
- id: '20e6760c',
- key: {
- dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'k8s_node_name',
- type: 'tag',
- },
- op: '=',
- value: node.meta.k8s_node_name,
- },
- ],
- op: 'AND',
- },
- functions: [],
- groupBy: [],
- having: [],
- legend: 'allocatable',
- limit: null,
- orderBy: [],
- queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'max',
- stepInterval: 60,
- timeAggregation: 'latest',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_container_memory_request--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_container_memory_request',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'C',
- filters: {
- items: [
- {
- id: 'fcc4d5e8',
- key: {
- dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'k8s_node_name',
- type: 'tag',
- },
- op: '=',
- value: node.meta.k8s_node_name,
- },
- ],
- op: 'AND',
- },
- functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'requests',
+ legend: '{{direction}} :: {{interface}}',
limit: null,
orderBy: [],
- queryName: 'C',
+ queryName: 'A',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'latest',
- },
- ],
- queryFormulas: [
- {
- disabled: false,
- expression: 'A/B',
- legend: 'used/allocatable',
- queryName: 'F1',
- },
- {
- disabled: false,
- expression: 'A/C',
- legend: 'used/request',
- queryName: 'F2',
+ timeAggregation: 'rate',
},
],
+ queryFormulas: [],
},
clickhouse_sql: [
{
@@ -995,31 +822,31 @@ export const getNodeQueryPayload = (
queryData: [
{
aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_pod_cpu_utilization--float64--Gauge--true',
+ dataType: DataTypes.String,
+ id: 'k8s_pod_network_errors--float64--Sum--true',
isColumn: true,
isJSON: false,
- key: 'k8s_pod_cpu_utilization',
- type: 'Gauge',
+ key: 'k8s_pod_network_errors',
+ type: 'Sum',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'increase',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'A',
filters: {
items: [
{
- id: '88d38c06',
+ id: '3aa8e064',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -1028,22 +855,30 @@ export const getNodeQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
- id: 'k8s_pod_name--string--tag--false',
+ id: 'interface--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_pod_name',
+ key: 'interface',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
type: 'tag',
},
],
having: [],
- legend: '{{k8s_pod_name}}',
- limit: 10,
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
orderBy: [],
queryName: 'A',
reduceTo: 'avg',
spaceAggregation: 'sum',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'increase',
},
],
queryFormulas: [],
@@ -1074,37 +909,37 @@ export const getNodeQueryPayload = (
},
{
selectedTime: 'GLOBAL_TIME',
- graphType: PANEL_TYPES.TIME_SERIES,
+ graphType: PANEL_TYPES.TABLE,
query: {
builder: {
queryData: [
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_pod_memory_usage--float64--Gauge--true',
+ id: 'k8s_statefulset_current_pods--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_pod_memory_usage',
+ key: 'k8s_statefulset_current_pods',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'A',
filters: {
items: [
{
- id: '43033387',
+ id: '5f2a55c5',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -1113,83 +948,50 @@ export const getNodeQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
- id: 'k8s_pod_name--string--tag--false',
+ id: 'k8s_statefulset_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_pod_name',
+ key: 'k8s_statefulset_name',
type: 'tag',
},
],
having: [],
- legend: '{{k8s_pod_name}}',
- limit: 10,
+ legend: 'current',
+ limit: null,
orderBy: [],
queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'latest',
},
- ],
- 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_node_network_errors--float64--Sum--true',
+ id: 'k8s_statefulset_desired_pods--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_network_errors',
- type: 'Sum',
+ key: 'k8s_statefulset_desired_pods',
+ type: 'Gauge',
},
- aggregateOperator: 'increase',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
- expression: 'A',
+ expression: 'B',
filters: {
items: [
{
- id: 'e9ce8079',
+ id: '13bd7a1d',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -1198,30 +1000,74 @@ export const getNodeQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
- id: 'direction--string--tag--false',
+ id: 'k8s_statefulset_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'direction',
+ key: 'k8s_statefulset_name',
type: 'tag',
},
+ ],
+ having: [],
+ legend: 'desired',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_statefulset_updated_pods--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_statefulset_updated_pods',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '9d287c73',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: namespace.namespaceName,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
{
dataType: DataTypes.String,
- id: 'interface--string--tag--false',
+ id: 'k8s_statefulset_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'interface',
+ key: 'k8s_statefulset_name',
type: 'tag',
},
],
having: [],
- legend: '{{direction}} :: {{interface}}',
+ legend: 'updated',
limit: null,
orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ queryName: 'C',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'increase',
+ timeAggregation: 'latest',
},
],
queryFormulas: [],
@@ -1246,43 +1092,43 @@ export const getNodeQueryPayload = (
queryType: EQueryType.QUERY_BUILDER,
},
variables: {},
- formatForWeb: false,
+ formatForWeb: true,
start,
end,
},
{
selectedTime: 'GLOBAL_TIME',
- graphType: PANEL_TYPES.TIME_SERIES,
+ graphType: PANEL_TYPES.TABLE,
query: {
builder: {
queryData: [
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_network_io--float64--Sum--true',
+ id: 'k8s_replicaset_desired--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_network_io',
- type: 'Sum',
+ key: 'k8s_replicaset_desired',
+ type: 'Gauge',
},
- aggregateOperator: 'rate',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'A',
filters: {
items: [
{
- id: 'd62d103f',
+ id: '0c1e655c',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
@@ -1291,30 +1137,86 @@ export const getNodeQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
- id: 'direction--string--tag--false',
+ id: 'k8s_replicaset_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'direction',
+ key: 'k8s_replicaset_name',
type: 'tag',
},
+ ],
+ having: [
+ {
+ columnName: 'MAX(k8s_replicaset_desired)',
+ op: '>',
+ value: 0,
+ },
+ ],
+ legend: 'desired',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_replicaset_available--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_replicaset_available',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'b2296bdb',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: namespace.namespaceName,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
{
dataType: DataTypes.String,
- id: 'interface--string--tag--false',
+ id: 'k8s_replicaset_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'interface',
+ key: 'k8s_replicaset_name',
type: 'tag',
},
],
- having: [],
- legend: '{{direction}} :: {{interface}}',
+ having: [
+ {
+ columnName: 'MAX(k8s_replicaset_available)',
+ op: '>',
+ value: 0,
+ },
+ ],
+ legend: 'available',
limit: null,
orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ queryName: 'B',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'rate',
+ timeAggregation: 'latest',
},
],
queryFormulas: [],
@@ -1339,144 +1241,223 @@ export const getNodeQueryPayload = (
queryType: EQueryType.QUERY_BUILDER,
},
variables: {},
- formatForWeb: false,
+ formatForWeb: true,
start,
end,
},
{
selectedTime: 'GLOBAL_TIME',
- graphType: PANEL_TYPES.TIME_SERIES,
+ graphType: PANEL_TYPES.TABLE,
query: {
builder: {
queryData: [
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_filesystem_usage--float64--Gauge--true',
+ id: 'k8s_daemonset_desired_scheduled_namespaces--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_filesystem_usage',
+ key: 'k8s_daemonset_desired_scheduled_namespaces',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'A',
filters: {
items: [
{
- id: 'b85d3580',
+ id: '2964eb92',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'used',
+ legend: 'desired',
limit: null,
orderBy: [],
queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'latest',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
+ id: 'k8s_daemonset_current_scheduled_namespaces--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_filesystem_capacity',
+ key: 'k8s_daemonset_current_scheduled_namespaces',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'B',
filters: {
items: [
{
- id: '23f502e1',
+ id: 'cd324eff',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'capacity',
+ legend: 'current',
limit: null,
orderBy: [],
queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'latest',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_filesystem_available--float64--Gauge--true',
+ id: 'k8s_daemonset_ready_namespaces--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_filesystem_available',
+ key: 'k8s_daemonset_ready_namespaces',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
disabled: false,
expression: 'C',
filters: {
items: [
{
- id: 'b80650ec',
+ id: '0416fa6f',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'available',
+ legend: 'ready',
limit: null,
orderBy: [],
queryName: 'C',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_daemonset_misscheduled_namespaces--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_daemonset_misscheduled_namespaces',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: 'c0a126d3',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_namespace_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_namespace_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: namespace.namespaceName,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_daemonset_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_daemonset_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: 'misscheduled',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
},
],
queryFormulas: [],
@@ -1501,99 +1482,117 @@ export const getNodeQueryPayload = (
queryType: EQueryType.QUERY_BUILDER,
},
variables: {},
- formatForWeb: false,
+ formatForWeb: true,
start,
end,
},
{
selectedTime: 'GLOBAL_TIME',
- graphType: PANEL_TYPES.TIME_SERIES,
+ graphType: PANEL_TYPES.TABLE,
query: {
builder: {
queryData: [
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_filesystem_usage--float64--Gauge--true',
+ id: 'k8s_deployment_desired--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_filesystem_usage',
+ key: 'k8s_deployment_desired',
type: 'Gauge',
},
- aggregateOperator: 'avg',
+ aggregateOperator: 'latest',
dataSource: DataSource.METRICS,
- disabled: true,
+ disabled: false,
expression: 'A',
filters: {
items: [
{
- id: 'b85d3580',
+ id: '9bc659c1',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'used',
+ legend: 'desired',
limit: null,
orderBy: [],
queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
- timeAggregation: 'avg',
+ timeAggregation: 'latest',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
- id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
+ id: 'k8s_deployment_available--float64--Gauge--true',
isColumn: true,
isJSON: false,
- key: 'k8s_node_filesystem_capacity',
+ key: 'k8s_deployment_available',
type: 'Gauge',
},
aggregateOperator: 'avg',
dataSource: DataSource.METRICS,
- disabled: true,
+ disabled: false,
expression: 'B',
filters: {
items: [
{
- id: '23f502e1',
+ id: 'e1696631',
key: {
dataType: DataTypes.String,
- id: 'k8s_node_name--string--tag--false',
+ id: 'k8s_namespace_name--string--tag--false',
isColumn: false,
isJSON: false,
- key: 'k8s_node_name',
+ key: 'k8s_namespace_name',
type: 'tag',
},
op: '=',
- value: node.meta.k8s_node_name,
+ value: namespace.namespaceName,
},
],
op: 'AND',
},
functions: [],
- groupBy: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_deployment_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_deployment_name',
+ type: 'tag',
+ },
+ ],
having: [],
- legend: 'capacity',
+ legend: 'available',
limit: null,
orderBy: [],
queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
+ reduceTo: 'last',
+ spaceAggregation: 'max',
stepInterval: 60,
timeAggregation: 'avg',
},
@@ -1627,7 +1626,7 @@ export const getNodeQueryPayload = (
queryType: EQueryType.QUERY_BUILDER,
},
variables: {},
- formatForWeb: false,
+ formatForWeb: true,
start,
end,
},
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/index.ts b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/index.ts
new file mode 100644
index 0000000000..0dc1f3330a
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/index.ts
@@ -0,0 +1,3 @@
+import NamespaceDetails from './NamespaceDetails';
+
+export default NamespaceDetails;
diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx
new file mode 100644
index 0000000000..d566c86910
--- /dev/null
+++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx
@@ -0,0 +1,169 @@
+import { Color } from '@signozhq/design-tokens';
+import { Tag } from 'antd';
+import { ColumnType } from 'antd/es/table';
+import {
+ K8sNamespacesData,
+ K8sNamespacesListPayload,
+} from 'api/infraMonitoring/getK8sNamespacesList';
+import { Group } from 'lucide-react';
+import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+
+import { formatBytes, ValidateColumnValueWrapper } from '../commonUtils';
+import { IEntityColumn } from '../utils';
+
+export const defaultAddedColumns: IEntityColumn[] = [
+ {
+ label: 'Namespace Name',
+ value: 'namespaceName',
+ id: 'namespaceName',
+ canRemove: false,
+ },
+ {
+ label: 'Cluster Name',
+ value: 'clusterName',
+ id: 'clusterName',
+ canRemove: false,
+ },
+ {
+ label: 'CPU Utilization (cores)',
+ value: 'cpu',
+ id: 'cpu',
+ canRemove: false,
+ },
+ {
+ label: 'Memory Utilization (bytes)',
+ value: 'memory',
+ id: 'memory',
+ canRemove: false,
+ },
+];
+
+export interface K8sNamespacesRowData {
+ key: string;
+ namespaceUID: string;
+ namespaceName: string;
+ clusterName: string;
+ cpu: React.ReactNode;
+ memory: React.ReactNode;
+ groupedByMeta?: any;
+}
+
+const namespaceGroupColumnConfig = {
+ title: (
+ <div className="column-header entity-group-header">
+ <Group size={14} /> NAMESPACE GROUP
+ </div>
+ ),
+ dataIndex: 'namespaceGroup',
+ key: 'namespaceGroup',
+ ellipsis: true,
+ width: 150,
+ align: 'left',
+ sorter: false,
+ className: 'column entity-group-header',
+};
+
+export const getK8sNamespacesListQuery = (): K8sNamespacesListPayload => ({
+ filters: {
+ items: [],
+ op: 'and',
+ },
+ orderBy: { columnName: 'cpu', order: 'desc' },
+});
+
+const columnsConfig = [
+ {
+ title: <div className="column-header-left">Namespace Name</div>,
+ dataIndex: 'namespaceName',
+ key: 'namespaceName',
+ ellipsis: true,
+ width: 120,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">Cluster Name</div>,
+ dataIndex: 'clusterName',
+ key: 'clusterName',
+ ellipsis: true,
+ width: 120,
+ sorter: false,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">CPU Usage (cores)</div>,
+ dataIndex: 'cpu',
+ key: 'cpu',
+ width: 100,
+ sorter: true,
+ align: 'left',
+ },
+ {
+ title: <div className="column-header-left">Mem Usage</div>,
+ dataIndex: 'memory',
+ key: 'memory',
+ width: 80,
+ sorter: true,
+ align: 'left',
+ },
+];
+
+export const getK8sNamespacesListColumns = (
+ groupBy: IBuilderQuery['groupBy'],
+): ColumnType<K8sNamespacesRowData>[] => {
+ if (groupBy.length > 0) {
+ const filteredColumns = [...columnsConfig].filter(
+ (column) => column.key !== 'namespaceName',
+ );
+ filteredColumns.unshift(namespaceGroupColumnConfig);
+ return filteredColumns as ColumnType<K8sNamespacesRowData>[];
+ }
+
+ return columnsConfig as ColumnType<K8sNamespacesRowData>[];
+};
+
+const getGroupByEle = (
+ namespace: K8sNamespacesData,
+ groupBy: IBuilderQuery['groupBy'],
+): React.ReactNode => {
+ const groupByValues: string[] = [];
+
+ groupBy.forEach((group) => {
+ groupByValues.push(namespace.meta[group.key as keyof typeof namespace.meta]);
+ });
+
+ return (
+ <div className="pod-group">
+ {groupByValues.map((value) => (
+ <Tag key={value} color={Color.BG_SLATE_400} className="pod-group-tag-item">
+ {value === '' ? '<no-value>' : value}
+ </Tag>
+ ))}
+ </div>
+ );
+};
+
+export const formatDataForTable = (
+ data: K8sNamespacesData[],
+ groupBy: IBuilderQuery['groupBy'],
+): K8sNamespacesRowData[] =>
+ data.map((namespace, index) => ({
+ key: index.toString(),
+ namespaceUID: namespace.namespaceName,
+ namespaceName: namespace.namespaceName,
+ clusterName: namespace.meta.k8s_cluster_name,
+ cpu: (
+ <ValidateColumnValueWrapper value={namespace.cpuUsage}>
+ {namespace.cpuUsage}
+ </ValidateColumnValueWrapper>
+ ),
+ memory: (
+ <ValidateColumnValueWrapper value={namespace.memoryUsage}>
+ {formatBytes(namespace.memoryUsage)}
+ </ValidateColumnValueWrapper>
+ ),
+ namespaceGroup: getGroupByEle(namespace, groupBy),
+ meta: namespace.meta,
+ ...namespace.meta,
+ groupedByMeta: namespace.meta,
+ }));
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
index 63cd557d32..32b0b7a9a3 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
@@ -406,7 +406,8 @@ function K8sNodesList({
groupBy.push(key);
}
}
-
+ // Reset pagination on switching to groupBy
+ setCurrentPage(1);
setGroupBy(groupBy);
setExpandedRowKeys([]);
},
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NoEventsContainer.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NoEventsContainer.tsx
deleted file mode 100644
index 0fafb37cae..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NoEventsContainer.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Color } from '@signozhq/design-tokens';
-import { Typography } from 'antd';
-import { Ghost } from 'lucide-react';
-
-const { Text } = Typography;
-
-export default function NoEventsContainer(): React.ReactElement {
- return (
- <div className="no-logs-found">
- <Text type="secondary">
- <Ghost size={24} color={Color.BG_AMBER_500} /> No events found for this node
- in the selected time range.
- </Text>
- </div>
- );
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.styles.scss b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.styles.scss
deleted file mode 100644
index 807ec2910a..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/NodeEvents.styles.scss
+++ /dev/null
@@ -1,289 +0,0 @@
-.node-events-container {
- margin-top: 1rem;
-
- .filter-section {
- flex: 1;
-
- .ant-select-selector {
- border-radius: 2px;
- border: 1px solid var(--bg-slate-400) !important;
- background-color: var(--bg-ink-300) !important;
-
- input {
- font-size: 12px;
- }
-
- .ant-tag .ant-typography {
- font-size: 12px;
- }
- }
- }
-
- .node-events-header {
- display: flex;
- justify-content: space-between;
- gap: 8px;
-
- padding: 12px;
- border-radius: 3px;
- border: 1px solid var(--bg-slate-500);
- }
-
- .node-events {
- margin-top: 1rem;
-
- .virtuoso-list {
- overflow-y: hidden !important;
-
- &::-webkit-scrollbar {
- width: 0.3rem;
- height: 0.3rem;
- }
-
- &::-webkit-scrollbar-track {
- background: transparent;
- }
-
- &::-webkit-scrollbar-thumb {
- background: var(--bg-slate-300);
- }
-
- &::-webkit-scrollbar-thumb:hover {
- background: var(--bg-slate-200);
- }
-
- .ant-row {
- width: fit-content;
- }
- }
-
- .skeleton-container {
- height: 100%;
- padding: 16px;
- }
- }
-
- .ant-table {
- .ant-table-thead > tr > th {
- padding: 12px;
- font-weight: 500;
- font-size: 12px;
- line-height: 18px;
-
- background: rgb(18, 19, 23);
- border-bottom: none;
-
- color: var(--Vanilla-400, #c0c1c3);
- font-family: Inter;
- font-size: 11px;
- font-style: normal;
- font-weight: 600;
- line-height: 18px; /* 163.636% */
- letter-spacing: 0.44px;
- text-transform: uppercase;
-
- &::before {
- background-color: transparent;
- }
- }
-
- .ant-table-thead > tr > th:has(.nodename-column-header) {
- background: var(--bg-ink-400);
- }
-
- .ant-table-cell {
- padding: 12px;
- font-size: 13px;
- line-height: 20px;
- color: var(--bg-vanilla-100);
- background: rgb(18, 19, 23);
- border-bottom: none;
- }
-
- .ant-table-cell:has(.nodename-column-value) {
- background: var(--bg-ink-400);
- }
-
- .nodename-column-value {
- color: var(--bg-vanilla-100);
- font-family: 'Geist Mono';
- font-style: normal;
- font-weight: 600;
- line-height: 20px; /* 142.857% */
- letter-spacing: -0.07px;
- }
-
- .status-cell {
- .active-tag {
- color: var(--bg-forest-500);
- padding: 4px 8px;
- border-radius: 4px;
- font-size: 12px;
- font-weight: 500;
- }
- }
-
- .progress-container {
- .ant-progress-bg {
- height: 8px !important;
- border-radius: 4px;
- }
- }
-
- .ant-table-tbody > tr:hover > td {
- background: rgba(255, 255, 255, 0.04);
- }
-
- .ant-table-cell:first-child {
- text-align: justify;
- }
-
- .ant-table-cell:nth-child(2) {
- padding-left: 16px;
- padding-right: 16px;
- }
-
- .ant-table-cell:nth-child(n + 3) {
- padding-right: 24px;
- }
- .column-header-right {
- text-align: right;
- }
- .ant-table-tbody > tr > td {
- border-bottom: none;
- }
-
- .ant-table-thead
- > tr
- > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
- background-color: transparent;
- }
-
- .ant-empty-normal {
- visibility: hidden;
- }
- }
-
- .ant-pagination {
- position: fixed;
- bottom: 0;
- width: calc(100% - 64px);
- background: rgb(18, 19, 23);
- padding: 16px;
- margin: 0;
-
- // this is to offset intercom icon till we improve the design
- padding-right: 72px;
-
- .ant-pagination-item {
- border-radius: 4px;
-
- &-active {
- background: var(--bg-robin-500);
- border-color: var(--bg-robin-500);
-
- a {
- color: var(--bg-ink-500) !important;
- }
- }
- }
- }
-}
-
-.node-events-list-container {
- flex: 1;
- height: calc(100vh - 272px) !important;
- display: flex;
- height: 100%;
-
- .raw-log-content {
- width: 100%;
- text-wrap: inherit;
- word-wrap: break-word;
- }
-}
-
-.node-events-list-card {
- width: 100%;
- margin-top: 12px;
-
- .ant-table-wrapper {
- height: 100%;
- overflow-y: auto;
-
- &::-webkit-scrollbar {
- width: 0.3rem;
- height: 0.3rem;
- }
-
- &::-webkit-scrollbar-track {
- background: transparent;
- }
-
- &::-webkit-scrollbar-thumb {
- background: var(--bg-slate-300);
- }
-
- &::-webkit-scrollbar-thumb:hover {
- background: var(--bg-slate-200);
- }
-
- .ant-row {
- width: fit-content;
- }
- }
-
- .ant-card-body {
- padding: 0;
-
- height: 100%;
- width: 100%;
- }
-}
-
-.logs-loading-skeleton {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 8px;
- padding: 8px 0;
-
- .ant-skeleton-input-sm {
- height: 18px;
- }
-}
-
-.no-logs-found {
- height: 50vh;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- padding: 24px;
- box-sizing: border-box;
-
- .ant-typography {
- display: flex;
- align-items: center;
- gap: 16px;
- }
-}
-
-.lightMode {
- .filter-section {
- border-top: 1px solid var(--bg-vanilla-300);
- border-bottom: 1px solid var(--bg-vanilla-300);
-
- .ant-select-selector {
- border-color: var(--bg-vanilla-300) !important;
- background-color: var(--bg-vanilla-100) !important;
- color: var(--bg-ink-200);
- }
- }
-}
-
-.periscope-btn-icon {
- cursor: pointer;
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/constants.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/constants.ts
deleted file mode 100644
index d4c5a13a35..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/constants.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 as uuidv4 } from 'uuid';
-
-export const getNodesEventsQueryPayload = (
- start: number,
- end: number,
- filters: IBuilderQuery['filters'],
-): GetQueryResultsProps => ({
- graphType: PANEL_TYPES.LIST,
- selectedTime: 'GLOBAL_TIME',
- query: {
- clickhouse_sql: [],
- promql: [],
- builder: {
- queryData: [
- {
- dataSource: DataSource.LOGS,
- queryName: 'A',
- aggregateOperator: 'noop',
- aggregateAttribute: {
- id: '------false',
- dataType: DataTypes.String,
- key: '',
- isColumn: false,
- type: '',
- isJSON: false,
- },
- timeAggregation: 'rate',
- spaceAggregation: 'sum',
- functions: [],
- filters,
- expression: 'A',
- disabled: false,
- stepInterval: 60,
- having: [],
- limit: null,
- orderBy: [
- {
- columnName: 'timestamp',
- order: 'desc',
- },
- ],
- groupBy: [],
- legend: '',
- reduceTo: 'avg',
- offset: 0,
- pageSize: 100,
- },
- ],
- queryFormulas: [],
- },
- id: uuidv4(),
- queryType: EQueryType.QUERY_BUILDER,
- },
- params: {
- lastLogLineTimestamp: null,
- },
- start,
- end,
-});
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/index.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/index.ts
deleted file mode 100644
index ce518fd1b7..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Events/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import NodeEvents from './NodeEvents';
-
-export default NodeEvents;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NoLogsContainer.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NoLogsContainer.tsx
deleted file mode 100644
index 6b4e96053f..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/NoLogsContainer.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Color } from '@signozhq/design-tokens';
-import { Typography } from 'antd';
-import { Ghost } from 'lucide-react';
-
-const { Text } = Typography;
-
-export default function NoLogsContainer(): React.ReactElement {
- return (
- <div className="no-logs-found">
- <Text type="secondary">
- <Ghost size={24} color={Color.BG_AMBER_500} /> No logs found for this node
- in the selected time range.
- </Text>
- </div>
- );
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/constants.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/constants.ts
deleted file mode 100644
index 64488e4db4..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/constants.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 as uuidv4 } from 'uuid';
-
-export const getNodeLogsQueryPayload = (
- start: number,
- end: number,
- filters: IBuilderQuery['filters'],
-): GetQueryResultsProps => ({
- graphType: PANEL_TYPES.LIST,
- selectedTime: 'GLOBAL_TIME',
- query: {
- clickhouse_sql: [],
- promql: [],
- builder: {
- queryData: [
- {
- dataSource: DataSource.LOGS,
- queryName: 'A',
- aggregateOperator: 'noop',
- aggregateAttribute: {
- id: '------false',
- dataType: DataTypes.String,
- key: '',
- isColumn: false,
- type: '',
- isJSON: false,
- },
- timeAggregation: 'rate',
- spaceAggregation: 'sum',
- functions: [],
- filters,
- expression: 'A',
- disabled: false,
- stepInterval: 60,
- having: [],
- limit: null,
- orderBy: [
- {
- columnName: 'timestamp',
- order: 'desc',
- },
- ],
- groupBy: [],
- legend: '',
- reduceTo: 'avg',
- offset: 0,
- pageSize: 100,
- },
- ],
- queryFormulas: [],
- },
- id: uuidv4(),
- queryType: EQueryType.QUERY_BUILDER,
- },
- params: {
- lastLogLineTimestamp: null,
- },
- start,
- end,
-});
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/index.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/index.ts
deleted file mode 100644
index 977dda6f01..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Logs/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import NodeLogs from './NodeLogsDetailedView';
-
-export default NodeLogs;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.styles.scss b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.styles.scss
deleted file mode 100644
index bb24b9a5fe..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.styles.scss
+++ /dev/null
@@ -1,45 +0,0 @@
-.empty-container {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
-}
-
-.node-metrics-container {
- margin-top: 1rem;
-}
-
-.metrics-header {
- display: flex;
- justify-content: flex-end;
- margin-top: 1rem;
-
- gap: 8px;
- padding: 12px;
- border-radius: 3px;
- border: 1px solid var(--bg-slate-500);
-}
-
-.node-metrics-card {
- margin: 8px 0 1rem 0;
- height: 300px;
- padding: 10px;
-
- border: 1px solid var(--bg-slate-500);
-
- .ant-card-body {
- padding: 0;
- }
-
- .chart-container {
- width: 100%;
- height: 100%;
- }
-
- .no-data-container {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.tsx
deleted file mode 100644
index 46d2c78cc1..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/NodeMetrics.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import './NodeMetrics.styles.scss';
-
-import { Card, Col, Row, Skeleton, Typography } from 'antd';
-import { K8sNodesData } from 'api/infraMonitoring/getK8sNodesList';
-import cx from 'classnames';
-import Uplot from 'components/Uplot';
-import { ENTITY_VERSION_V4 } from 'constants/app';
-import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
-import {
- CustomTimeType,
- Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
-import { useIsDarkMode } from 'hooks/useDarkMode';
-import { useResizeObserver } from 'hooks/useDimensions';
-import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
-import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
-import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
-import { useMemo, useRef } from 'react';
-import { useQueries, UseQueryResult } from 'react-query';
-import { SuccessResponse } from 'types/api';
-import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
-
-import { getNodeQueryPayload, nodeWidgetInfo } from './constants';
-
-interface NodeMetricsProps {
- timeRange: {
- startTime: number;
- endTime: number;
- };
- isModalTimeSelection: boolean;
- handleTimeChange: (
- interval: Time | CustomTimeType,
- dateTimeRange?: [number, number],
- ) => void;
- selectedInterval: Time;
- node: K8sNodesData;
-}
-
-function NodeMetrics({
- selectedInterval,
- node,
- timeRange,
- handleTimeChange,
- isModalTimeSelection,
-}: NodeMetricsProps): JSX.Element {
- const queryPayloads = useMemo(
- () => getNodeQueryPayload(node, timeRange.startTime, timeRange.endTime),
- [node, timeRange.startTime, timeRange.endTime],
- );
-
- const queries = useQueries(
- queryPayloads.map((payload) => ({
- queryKey: ['node-metrics', payload, ENTITY_VERSION_V4, 'NODE'],
- queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
- GetMetricQueryRange(payload, ENTITY_VERSION_V4),
- enabled: !!payload,
- })),
- );
-
- const isDarkMode = useIsDarkMode();
- const graphRef = useRef<HTMLDivElement>(null);
- const dimensions = useResizeObserver(graphRef);
-
- const chartData = useMemo(
- () => queries.map(({ data }) => getUPlotChartData(data?.payload)),
- [queries],
- );
-
- const options = useMemo(
- () =>
- queries.map(({ data }, idx) =>
- getUPlotChartOptions({
- apiResponse: data?.payload,
- isDarkMode,
- dimensions,
- yAxisUnit: nodeWidgetInfo[idx].yAxisUnit,
- softMax: null,
- softMin: null,
- minTimeScale: timeRange.startTime,
- maxTimeScale: timeRange.endTime,
- }),
- ),
- [queries, isDarkMode, dimensions, timeRange.startTime, timeRange.endTime],
- );
-
- const renderCardContent = (
- query: UseQueryResult<SuccessResponse<MetricRangePayloadProps>, unknown>,
- idx: number,
- ): JSX.Element => {
- if (query.isLoading) {
- return <Skeleton />;
- }
-
- if (query.error) {
- const errorMessage =
- (query.error as Error)?.message || 'Something went wrong';
- return <div>{errorMessage}</div>;
- }
- return (
- <div
- className={cx('chart-container', {
- 'no-data-container':
- !query.isLoading && !query?.data?.payload?.data?.result?.length,
- })}
- >
- <Uplot options={options[idx]} data={chartData[idx]} />
- </div>
- );
- };
-
- return (
- <>
- <div className="metrics-header">
- <div className="metrics-datetime-section">
- <DateTimeSelectionV2
- showAutoRefresh={false}
- showRefreshText={false}
- hideShareModal
- onTimeChange={handleTimeChange}
- defaultRelativeTime="5m"
- isModalTimeSelection={isModalTimeSelection}
- modalSelectedInterval={selectedInterval}
- />
- </div>
- </div>
- <Row gutter={24} className="node-metrics-container">
- {queries.map((query, idx) => (
- <Col span={12} key={nodeWidgetInfo[idx].title}>
- <Typography.Text>{nodeWidgetInfo[idx].title}</Typography.Text>
- <Card bordered className="node-metrics-card" ref={graphRef}>
- {renderCardContent(query, idx)}
- </Card>
- </Col>
- ))}
- </Row>
- </>
- );
-}
-
-export default NodeMetrics;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/index.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/index.ts
deleted file mode 100644
index 3c2c065a5f..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Metrics/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import NodeMetrics from './NodeMetrics';
-
-export default NodeMetrics;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.styles.scss b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.styles.scss
deleted file mode 100644
index 76014ba387..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.styles.scss
+++ /dev/null
@@ -1,247 +0,0 @@
-.node-detail-drawer {
- border-left: 1px solid var(--bg-slate-500);
- background: var(--bg-ink-400);
- box-shadow: -4px 10px 16px 2px rgba(0, 0, 0, 0.2);
-
- .ant-drawer-header {
- padding: 8px 16px;
- border-bottom: none;
-
- align-items: stretch;
-
- border-bottom: 1px solid var(--bg-slate-500);
- background: var(--bg-ink-400);
- }
-
- .ant-drawer-close {
- margin-inline-end: 0px;
- }
-
- .ant-drawer-body {
- display: flex;
- flex-direction: column;
- padding: 16px;
- }
-
- .title {
- color: var(--text-vanilla-400);
- font-family: 'Geist Mono';
- font-size: 14px;
- font-style: normal;
- font-weight: 500;
- line-height: 20px; /* 142.857% */
- letter-spacing: -0.07px;
- }
-
- .radio-button {
- display: flex;
- align-items: center;
- justify-content: center;
- padding-top: var(--padding-1);
- border: 1px solid var(--bg-slate-400);
- background: var(--bg-ink-300);
- box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
- }
-
- .node-detail-drawer__node {
- .node-details-grid {
- .labels-row,
- .values-row {
- display: grid;
- grid-template-columns: 1fr 1.5fr 1.5fr 1.5fr;
- gap: 30px;
- align-items: center;
- }
-
- .labels-row {
- margin-bottom: 8px;
- }
-
- .node-details-metadata-label {
- color: var(--text-vanilla-400);
- font-family: Inter;
- font-size: 11px;
- font-style: normal;
- font-weight: 500;
- line-height: 18px; /* 163.636% */
- letter-spacing: 0.44px;
- text-transform: uppercase;
- }
-
- .node-details-metadata-value {
- color: var(--text-vanilla-400);
- font-family: 'Geist Mono';
- font-size: 12px;
- font-style: normal;
- font-weight: 500;
- line-height: 20px; /* 142.857% */
- letter-spacing: -0.07px;
-
- width: 100%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- .status-tag {
- margin: 0;
-
- &.active {
- color: var(--success-500);
- background: var(--success-100);
- border-color: var(--success-500);
- }
-
- &.inactive {
- color: var(--error-500);
- background: var(--error-100);
- border-color: var(--error-500);
- }
- }
-
- .progress-container {
- width: 158px;
- .ant-progress {
- margin: 0;
-
- .ant-progress-text {
- font-weight: 600;
- }
- }
- }
-
- .ant-card {
- &.ant-card-bordered {
- border: 1px solid var(--bg-slate-500) !important;
- }
- }
- }
- }
-
- .tabs-and-search {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 16px 0;
-
- .action-btn {
- border-radius: 2px;
- border: 1px solid var(--bg-slate-400);
- background: var(--bg-ink-300);
- box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
-
- .views-tabs-container {
- margin-top: 1.5rem;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .views-tabs {
- color: var(--text-vanilla-400);
-
- .view-title {
- display: flex;
- gap: var(--margin-2);
- align-items: center;
- justify-content: center;
- font-size: var(--font-size-xs);
- font-style: normal;
- font-weight: var(--font-weight-normal);
- }
-
- .tab {
- border: 1px solid var(--bg-slate-400);
- width: 114px;
- }
-
- .tab::before {
- background: var(--bg-slate-400);
- }
-
- .selected_view {
- background: var(--bg-slate-300);
- color: var(--text-vanilla-100);
- border: 1px solid var(--bg-slate-400);
- }
-
- .selected_view::before {
- background: var(--bg-slate-400);
- }
- }
-
- .compass-button {
- width: 30px;
- height: 30px;
-
- border-radius: 2px;
- border: 1px solid var(--bg-slate-400);
- background: var(--bg-ink-300);
- box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
- }
- }
- .ant-drawer-close {
- padding: 0px;
- }
-}
-
-.lightMode {
- .ant-drawer-header {
- border-bottom: 1px solid var(--bg-vanilla-400);
- background: var(--bg-vanilla-100);
- }
-
- .node-detail-drawer {
- .title {
- color: var(--text-ink-300);
- }
-
- .node-detail-drawer__node {
- .ant-typography {
- color: var(--text-ink-300);
- background: transparent;
- }
- }
-
- .radio-button {
- border: 1px solid var(--bg-vanilla-400);
- background: var(--bg-vanilla-100);
- color: var(--text-ink-300);
- }
-
- .views-tabs {
- .tab {
- background: var(--bg-vanilla-100);
- }
-
- .selected_view {
- background: var(--bg-vanilla-300);
- border: 1px solid var(--bg-slate-300);
- color: var(--text-ink-400);
- }
-
- .selected_view::before {
- background: var(--bg-vanilla-300);
- border-left: 1px solid var(--bg-slate-300);
- }
- }
-
- .compass-button {
- border: 1px solid var(--bg-vanilla-300);
- background: var(--bg-vanilla-100);
- box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
- }
-
- .tabs-and-search {
- .action-btn {
- border: 1px solid var(--bg-vanilla-400);
- background: var(--bg-vanilla-100);
- color: var(--text-ink-300);
- }
- }
- }
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
index 33ecd20c36..7d7d3ae4d0 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/NodeDetails.tsx
@@ -1,10 +1,11 @@
/* eslint-disable sonarjs/no-identical-functions */
-import './NodeDetails.styles.scss';
+import '../../EntityDetailsUtils/entityDetails.styles.scss';
import { Color, Spacing } from '@signozhq/design-tokens';
import { Button, Divider, Drawer, Radio, Tooltip, Typography } from 'antd';
import { RadioChangeEvent } from 'antd/lib';
import logEvent from 'api/common/logEvent';
+import { K8sNodesData } from 'api/infraMonitoring/getK8sNodesList';
import { VIEW_TYPES, VIEWS } from 'components/HostMetricsDetail/constants';
import { QueryParams } from 'constants/query';
import {
@@ -12,7 +13,9 @@ import {
initialQueryState,
} from 'constants/queryBuilder';
import ROUTES from 'constants/routes';
-import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/entityDetailUtils';
+import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
+import NodeEvents from 'container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents';
import {
CustomTimeType,
Time,
@@ -43,12 +46,12 @@ import {
import { GlobalReducer } from 'types/reducer/globalTime';
import { v4 as uuidv4 } from 'uuid';
-import { QUERY_KEYS } from './constants';
-import NodeEvents from './Events';
-import NodeLogs from './Logs';
-import NodeMetrics from './Metrics';
+import NodeLogs from '../../EntityDetailsUtils/EntityLogs';
+import NodeMetrics from '../../EntityDetailsUtils/EntityMetrics';
+import NodeTraces from '../../EntityDetailsUtils/EntityTraces';
+import { QUERY_KEYS } from '../../EntityDetailsUtils/utils';
+import { getNodeMetricsQueryPayload, nodeWidgetInfo } from './constants';
import { NodeDetailsProps } from './NodeDetails.interfaces';
-import NodeTraces from './Traces';
function NodeDetails({
node,
@@ -402,35 +405,35 @@ function NodeDetails({
overscrollBehavior: 'contain',
background: isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100,
}}
- className="node-detail-drawer"
+ className="entity-detail-drawer"
destroyOnClose
closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
>
{node && (
<>
- <div className="node-detail-drawer__node">
- <div className="node-details-grid">
+ <div className="entity-detail-drawer__entity">
+ <div className="entity-details-grid">
<div className="labels-row">
<Typography.Text
type="secondary"
- className="node-details-metadata-label"
+ className="entity-details-metadata-label"
>
Node Name
</Typography.Text>
<Typography.Text
type="secondary"
- className="node-details-metadata-label"
+ className="entity-details-metadata-label"
>
Cluster Name
</Typography.Text>
</div>
<div className="values-row">
- <Typography.Text className="node-details-metadata-value">
+ <Typography.Text className="entity-details-metadata-value">
<Tooltip title={node.meta.k8s_node_name}>
{node.meta.k8s_node_name}
</Tooltip>
</Typography.Text>
- <Typography.Text className="node-details-metadata-value">
+ <Typography.Text className="entity-details-metadata-value">
<Tooltip title="Cluster name">{node.meta.k8s_cluster_name}</Tooltip>
</Typography.Text>
</div>
@@ -500,12 +503,16 @@ function NodeDetails({
)}
</div>
{selectedView === VIEW_TYPES.METRICS && (
- <NodeMetrics
+ <NodeMetrics<K8sNodesData>
timeRange={modalTimeRange}
isModalTimeSelection={isModalTimeSelection}
handleTimeChange={handleTimeChange}
selectedInterval={selectedInterval}
- node={node}
+ entity={node}
+ entityWidgetInfo={nodeWidgetInfo}
+ getEntityQueryPayload={getNodeMetricsQueryPayload}
+ category={K8sCategory.NODES}
+ queryKey="nodeMetrics"
/>
)}
{selectedView === VIEW_TYPES.LOGS && (
@@ -516,6 +523,9 @@ function NodeDetails({
handleChangeLogFilters={handleChangeLogFilters}
logFilters={logFilters}
selectedInterval={selectedInterval}
+ queryKeyFilters={[QUERY_KEYS.K8S_NODE_NAME, QUERY_KEYS.K8S_CLUSTER_NAME]}
+ queryKey="nodeLogs"
+ category={K8sCategory.NODES}
/>
)}
{selectedView === VIEW_TYPES.TRACES && (
@@ -526,6 +536,7 @@ function NodeDetails({
handleChangeTracesFilters={handleChangeTracesFilters}
tracesFilters={tracesFilters}
selectedInterval={selectedInterval}
+ queryKey="nodeTraces"
/>
)}
{selectedView === VIEW_TYPES.EVENTS && (
@@ -536,6 +547,8 @@ function NodeDetails({
isModalTimeSelection={isModalTimeSelection}
handleTimeChange={handleTimeChange}
selectedInterval={selectedInterval}
+ category={K8sCategory.NODES}
+ queryKey="nodeEvents"
/>
)}
</>
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.styles.scss b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.styles.scss
deleted file mode 100644
index ab082d210f..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/NodeTraces.styles.scss
+++ /dev/null
@@ -1,193 +0,0 @@
-.node-metric-traces {
- margin-top: 1rem;
-
- .node-metric-traces-header {
- display: flex;
- justify-content: space-between;
- margin-bottom: 1rem;
-
- gap: 8px;
- padding: 12px;
- border-radius: 3px;
- border: 1px solid var(--bg-slate-500);
-
- .filter-section {
- flex: 1;
-
- .ant-select-selector {
- border-radius: 2px;
- border: 1px solid var(--bg-slate-400) !important;
- background-color: var(--bg-ink-300) !important;
-
- input {
- font-size: 12px;
- }
-
- .ant-tag .ant-typography {
- font-size: 12px;
- }
- }
- }
- }
-
- .node-metric-traces-table {
- .ant-table-content {
- overflow: hidden !important;
- }
-
- .ant-table {
- border-radius: 3px;
- border: 1px solid var(--bg-slate-500);
-
- .ant-table-thead > tr > th {
- padding: 12px;
- font-weight: 500;
- font-size: 12px;
- line-height: 18px;
-
- background: rgba(171, 189, 255, 0.01);
- border-bottom: none;
-
- color: var(--Vanilla-400, #c0c1c3);
- font-family: Inter;
- font-size: 11px;
- font-style: normal;
- font-weight: 600;
- line-height: 18px; /* 163.636% */
- letter-spacing: 0.44px;
- text-transform: uppercase;
-
- &::before {
- background-color: transparent;
- }
- }
-
- .ant-table-thead > tr > th:has(.hostname-column-header) {
- background: var(--bg-ink-400);
- }
-
- .ant-table-cell {
- padding: 12px;
- font-size: 13px;
- line-height: 20px;
- color: var(--bg-vanilla-100);
- background: rgba(171, 189, 255, 0.01);
- }
-
- .ant-table-cell:has(.hostname-column-value) {
- background: var(--bg-ink-400);
- }
-
- .hostname-column-value {
- color: var(--bg-vanilla-100);
- font-family: 'Geist Mono';
- font-style: normal;
- font-weight: 600;
- line-height: 20px; /* 142.857% */
- letter-spacing: -0.07px;
- }
-
- .status-cell {
- .active-tag {
- color: var(--bg-forest-500);
- padding: 4px 8px;
- border-radius: 4px;
- font-size: 12px;
- font-weight: 500;
- }
- }
-
- .progress-container {
- .ant-progress-bg {
- height: 8px !important;
- border-radius: 4px;
- }
- }
-
- .ant-table-tbody > tr:hover > td {
- background: rgba(255, 255, 255, 0.04);
- }
-
- .ant-table-cell:first-child {
- text-align: justify;
- }
-
- .ant-table-cell:nth-child(2) {
- padding-left: 16px;
- padding-right: 16px;
- }
-
- .ant-table-cell:nth-child(n + 3) {
- padding-right: 24px;
- }
- .column-header-right {
- text-align: right;
- }
- .ant-table-tbody > tr > td {
- border-bottom: none;
- }
-
- .ant-table-thead
- > tr
- > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
- background-color: transparent;
- }
-
- .ant-empty-normal {
- visibility: hidden;
- }
- }
-
- .ant-table-container::after {
- content: none;
- }
- }
-}
-
-.lightMode {
- .host-metric-traces-header {
- .filter-section {
- border-top: 1px solid var(--bg-vanilla-300);
- border-bottom: 1px solid var(--bg-vanilla-300);
-
- .ant-select-selector {
- border-color: var(--bg-vanilla-300) !important;
- background-color: var(--bg-vanilla-100) !important;
- color: var(--bg-ink-200);
- }
- }
- }
-
- .host-metric-traces-table {
- .ant-table {
- border-radius: 3px;
- border: 1px solid var(--bg-vanilla-300);
-
- .ant-table-thead > tr > th {
- background: var(--bg-vanilla-100);
- color: var(--text-ink-300);
- }
-
- .ant-table-thead > tr > th:has(.hostname-column-header) {
- background: var(--bg-vanilla-100);
- }
-
- .ant-table-cell {
- background: var(--bg-vanilla-100);
- color: var(--bg-ink-500);
- }
-
- .ant-table-cell:has(.hostname-column-value) {
- background: var(--bg-vanilla-100);
- }
-
- .hostname-column-value {
- color: var(--bg-ink-300);
- }
-
- .ant-table-tbody > tr:hover > td {
- background: rgba(0, 0, 0, 0.04);
- }
- }
- }
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/constants.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/constants.ts
deleted file mode 100644
index f1b5950503..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/constants.ts
+++ /dev/null
@@ -1,200 +0,0 @@
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import {
- BaseAutocompleteData,
- DataTypes,
-} from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { nanoToMilli } from 'utils/timeUtils';
-
-export const columns = [
- {
- dataIndex: 'timestamp',
- key: 'timestamp',
- title: 'Timestamp',
- width: 200,
- render: (timestamp: string): string => new Date(timestamp).toLocaleString(),
- },
- {
- title: 'Service Name',
- dataIndex: ['data', 'serviceName'],
- key: 'serviceName-string-tag',
- width: 150,
- },
- {
- title: 'Name',
- dataIndex: ['data', 'name'],
- key: 'name-string-tag',
- width: 145,
- },
- {
- title: 'Duration',
- dataIndex: ['data', 'durationNano'],
- key: 'durationNano-float64-tag',
- width: 145,
- render: (duration: number): string => `${nanoToMilli(duration)}ms`,
- },
- {
- title: 'HTTP Method',
- dataIndex: ['data', 'httpMethod'],
- key: 'httpMethod-string-tag',
- width: 145,
- },
- {
- title: 'Status Code',
- dataIndex: ['data', 'responseStatusCode'],
- key: 'responseStatusCode-string-tag',
- width: 145,
- },
-];
-
-export const selectedColumns: BaseAutocompleteData[] = [
- {
- key: 'timestamp',
- dataType: DataTypes.String,
- type: 'tag',
- isColumn: true,
- },
- {
- key: 'serviceName',
- dataType: DataTypes.String,
- type: 'tag',
- isColumn: true,
- },
- {
- key: 'name',
- dataType: DataTypes.String,
- type: 'tag',
- isColumn: true,
- },
- {
- key: 'durationNano',
- dataType: DataTypes.Float64,
- type: 'tag',
- isColumn: true,
- },
- {
- key: 'httpMethod',
- dataType: DataTypes.String,
- type: 'tag',
- isColumn: true,
- },
- {
- key: 'responseStatusCode',
- dataType: DataTypes.String,
- type: 'tag',
- isColumn: true,
- },
-];
-
-export const getNodeTracesQueryPayload = (
- start: number,
- end: number,
- offset = 0,
- filters: IBuilderQuery['filters'],
-): GetQueryResultsProps => ({
- query: {
- promql: [],
- clickhouse_sql: [],
- builder: {
- queryData: [
- {
- dataSource: DataSource.TRACES,
- queryName: 'A',
- aggregateOperator: 'noop',
- aggregateAttribute: {
- id: '------false',
- dataType: DataTypes.EMPTY,
- key: '',
- isColumn: false,
- type: '',
- isJSON: false,
- },
- timeAggregation: 'rate',
- spaceAggregation: 'sum',
- functions: [],
- filters,
- expression: 'A',
- disabled: false,
- stepInterval: 60,
- having: [],
- limit: null,
- orderBy: [
- {
- columnName: 'timestamp',
- order: 'desc',
- },
- ],
- groupBy: [],
- legend: '',
- reduceTo: 'avg',
- },
- ],
- queryFormulas: [],
- },
- id: '572f1d91-6ac0-46c0-b726-c21488b34434',
- queryType: EQueryType.QUERY_BUILDER,
- },
- graphType: PANEL_TYPES.LIST,
- selectedTime: 'GLOBAL_TIME',
- start,
- end,
- params: {
- dataSource: DataSource.TRACES,
- },
- tableParams: {
- pagination: {
- limit: 10,
- offset,
- },
- selectColumns: [
- {
- key: 'serviceName',
- dataType: 'string',
- type: 'tag',
- isColumn: true,
- isJSON: false,
- id: 'serviceName--string--tag--true',
- isIndexed: false,
- },
- {
- key: 'name',
- dataType: 'string',
- type: 'tag',
- isColumn: true,
- isJSON: false,
- id: 'name--string--tag--true',
- isIndexed: false,
- },
- {
- key: 'durationNano',
- dataType: 'float64',
- type: 'tag',
- isColumn: true,
- isJSON: false,
- id: 'durationNano--float64--tag--true',
- isIndexed: false,
- },
- {
- key: 'httpMethod',
- dataType: 'string',
- type: 'tag',
- isColumn: true,
- isJSON: false,
- id: 'httpMethod--string--tag--true',
- isIndexed: false,
- },
- {
- key: 'responseStatusCode',
- dataType: 'string',
- type: 'tag',
- isColumn: true,
- isJSON: false,
- id: 'responseStatusCode--string--tag--true',
- isIndexed: false,
- },
- ],
- },
-});
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/index.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/index.ts
deleted file mode 100644
index a5bc66c59b..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/Traces/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import NodeTraces from './NodeTraces';
-
-export default NodeTraces;
diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts
index e771ffa91f..e491d03d3c 100644
--- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts
@@ -1,6 +1,1634 @@
-export const QUERY_KEYS = {
- K8S_OBJECT_KIND: 'k8s.object.kind',
- K8S_OBJECT_NAME: 'k8s.object.name',
- K8S_NODE_NAME: 'k8s.node.name',
- K8S_CLUSTER_NAME: 'k8s.cluster.name',
-};
+/* eslint-disable sonarjs/no-duplicate-string */
+import { K8sNodesData } from 'api/infraMonitoring/getK8sNodesList';
+import { PANEL_TYPES } from 'constants/queryBuilder';
+import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { EQueryType } from 'types/common/dashboard';
+import { DataSource } from 'types/common/queryBuilder';
+import { v4 } from 'uuid';
+
+export const nodeWidgetInfo = [
+ {
+ title: 'CPU Usage (cores)',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Memory Usage (bytes)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'CPU Usage (%)',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Memory Usage (%)',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Pods by CPU (top 10)',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Pods by Memory (top 10)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Network error count',
+ yAxisUnit: '',
+ },
+ {
+ title: 'Network IO rate',
+ yAxisUnit: 'binBps',
+ },
+ {
+ title: 'Filesystem usage (bytes)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Filesystem usage (%)',
+ yAxisUnit: 'percentunit',
+ },
+];
+
+export const getNodeMetricsQueryPayload = (
+ node: K8sNodesData,
+ start: number,
+ end: number,
+): GetQueryResultsProps[] => [
+ {
+ selectedTime: 'GLOBAL_TIME',
+ graphType: PANEL_TYPES.TIME_SERIES,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '441b62d7',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (avg)',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_cpu',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'b205b1a3',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_cpu_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_cpu_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '884c2bf3',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: '98be9da1',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (max)',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'min',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'E',
+ filters: {
+ items: [
+ {
+ id: 'ce97dd7b',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (min)',
+ limit: null,
+ orderBy: [],
+ queryName: 'E',
+ 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_node_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'fdffcbb2',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (avg)',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_memory--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_memory',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '9b79a8bd',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '3387fb4a',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'max',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'D',
+ filters: {
+ items: [
+ {
+ id: 'd1ad7ccb',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (max)',
+ limit: null,
+ orderBy: [],
+ queryName: 'D',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'max',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'min',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'E',
+ filters: {
+ items: [
+ {
+ id: '5e578329',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used (min)',
+ limit: null,
+ orderBy: [],
+ queryName: 'E',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'min',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_memory_working_set--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_working_set',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'F',
+ filters: {
+ items: [
+ {
+ id: '6ab3ec98',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'working set',
+ limit: null,
+ orderBy: [],
+ queryName: 'F',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_memory_rss--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_rss',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'G',
+ filters: {
+ items: [
+ {
+ id: '80c9a1db',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'rss',
+ limit: null,
+ orderBy: [],
+ queryName: 'G',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '752765ef',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_cpu',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'f0c5c1ed',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_cpu_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_cpu_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'b952b389',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ ],
+ queryFormulas: [
+ {
+ disabled: false,
+ expression: 'A/B',
+ legend: 'used/allocatable',
+ queryName: 'F1',
+ },
+ {
+ disabled: false,
+ expression: 'A/C',
+ legend: 'used/request',
+ queryName: 'F2',
+ },
+ ],
+ },
+ 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_node_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'c2a2c926',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_allocatable_memory--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_allocatable_memory',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '20e6760c',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'allocatable',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'fcc4d5e8',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'requests',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ ],
+ queryFormulas: [
+ {
+ disabled: false,
+ expression: 'A/B',
+ legend: 'used/allocatable',
+ queryName: 'F1',
+ },
+ {
+ disabled: false,
+ expression: 'A/C',
+ legend: 'used/request',
+ queryName: 'F2',
+ },
+ ],
+ },
+ 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_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: '88d38c06',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{k8s_pod_name}}',
+ limit: 10,
+ 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,
+ 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: '43033387',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'k8s_pod_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_pod_name',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{k8s_pod_name}}',
+ limit: 10,
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_network_errors--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_network_errors',
+ type: 'Sum',
+ },
+ aggregateOperator: 'increase',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'e9ce8079',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'increase',
+ },
+ ],
+ 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_node_network_io--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_network_io',
+ type: 'Sum',
+ },
+ aggregateOperator: 'rate',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'd62d103f',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'rate',
+ },
+ ],
+ 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_node_filesystem_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_filesystem_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'b85d3580',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_filesystem_capacity',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '23f502e1',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'capacity',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_filesystem_available--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_filesystem_available',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'b80650ec',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'available',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_filesystem_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_filesystem_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'b85d3580',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'used',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_node_filesystem_capacity',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '23f502e1',
+ key: {
+ dataType: DataTypes.String,
+ id: 'k8s_node_name--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'k8s_node_name',
+ type: 'tag',
+ },
+ op: '=',
+ value: node.meta.k8s_node_name,
+ },
+ ],
+ op: 'AND',
+ },
+ functions: [],
+ groupBy: [],
+ having: [],
+ legend: 'capacity',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ ],
+ queryFormulas: [
+ {
+ disabled: false,
+ expression: 'A/B',
+ legend: 'util %',
+ 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,
+ },
+];
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
index 4628143b1b..d8a6e5583e 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx
@@ -170,7 +170,7 @@ function K8sPodsList({
selectedRowData: K8sPodsRowData,
): IBuilderQuery['filters'] => {
const baseFilters: IBuilderQuery['filters'] = {
- items: [...query.filters.items],
+ items: [...queryFilters.items],
op: 'and',
};
@@ -298,8 +298,9 @@ function K8sPodsList({
}
}
+ // Reset pagination on switching to groupBy
+ setCurrentPage(1);
setGroupBy(groupBy);
-
setExpandedRowKeys([]);
},
[groupByFiltersData],
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.tsx
deleted file mode 100644
index e2be874e6d..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/Events.tsx
+++ /dev/null
@@ -1,360 +0,0 @@
-/* eslint-disable no-nested-ternary */
-import './Events.styles.scss';
-
-import { Color } from '@signozhq/design-tokens';
-import { Button, Table, TableColumnsType } from 'antd';
-import { DEFAULT_ENTITY_VERSION } from 'constants/app';
-import { EventContents } from 'container/InfraMonitoringK8s/commonUtils';
-import LoadingContainer from 'container/InfraMonitoringK8s/LoadingContainer';
-import LogsError from 'container/LogsError/LogsError';
-import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
-import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch';
-import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
-import {
- CustomTimeType,
- Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
-import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
-import { isArray } from 'lodash-es';
-import { ChevronDown, ChevronLeft, ChevronRight, Loader2 } from 'lucide-react';
-import { useEffect, useMemo, useState } from 'react';
-import { useQuery } from 'react-query';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 } from 'uuid';
-
-import { getPodsEventsQueryPayload } from './constants';
-import NoEventsContainer from './NoEventsContainer';
-
-interface EventDataType {
- key: string;
- timestamp: string;
- body: string;
- id: string;
- attributes_bool?: Record<string, boolean>;
- attributes_number?: Record<string, number>;
- attributes_string?: Record<string, string>;
- resources_string?: Record<string, string>;
- scope_name?: string;
- scope_string?: Record<string, string>;
- scope_version?: string;
- severity_number?: number;
- severity_text?: string;
- span_id?: string;
- trace_flags?: number;
- trace_id?: string;
- severity?: string;
-}
-
-interface IPodEventsProps {
- timeRange: {
- startTime: number;
- endTime: number;
- };
- handleChangeLogFilters: (filters: IBuilderQuery['filters']) => void;
- filters: IBuilderQuery['filters'];
- isModalTimeSelection: boolean;
- handleTimeChange: (
- interval: Time | CustomTimeType,
- dateTimeRange?: [number, number],
- ) => void;
- selectedInterval: Time;
-}
-
-const EventsPageSize = 10;
-
-export default function Events({
- timeRange,
- handleChangeLogFilters,
- filters,
- isModalTimeSelection,
- handleTimeChange,
- selectedInterval,
-}: IPodEventsProps): JSX.Element {
- const { currentQuery } = useQueryBuilder();
-
- const [formattedPodEvents, setFormattedPodEvents] = useState<EventDataType[]>(
- [],
- );
-
- const [hasReachedEndOfEvents, setHasReachedEndOfEvents] = useState(false);
-
- const [page, setPage] = useState(1);
-
- const updatedCurrentQuery = useMemo(
- () => ({
- ...currentQuery,
- builder: {
- ...currentQuery.builder,
- queryData: [
- {
- ...currentQuery.builder.queryData[0],
- dataSource: DataSource.LOGS,
- aggregateOperator: 'noop',
- aggregateAttribute: {
- ...currentQuery.builder.queryData[0].aggregateAttribute,
- },
- filters: {
- items: [],
- op: 'AND',
- },
- },
- ],
- },
- }),
- [currentQuery],
- );
-
- const query = updatedCurrentQuery?.builder?.queryData[0] || null;
-
- const queryPayload = useMemo(() => {
- const basePayload = getPodsEventsQueryPayload(
- timeRange.startTime,
- timeRange.endTime,
- filters,
- );
-
- basePayload.query.builder.queryData[0].pageSize = 10;
- basePayload.query.builder.queryData[0].orderBy = [
- { columnName: 'timestamp', order: ORDERBY_FILTERS.DESC },
- ];
-
- return basePayload;
- }, [timeRange.startTime, timeRange.endTime, filters]);
-
- const { data: eventsData, isLoading, isFetching, isError } = useQuery({
- queryKey: ['podEvents', timeRange.startTime, timeRange.endTime, filters],
- queryFn: () => GetMetricQueryRange(queryPayload, DEFAULT_ENTITY_VERSION),
- enabled: !!queryPayload,
- });
-
- const columns: TableColumnsType<EventDataType> = [
- { title: 'Severity', dataIndex: 'severity', key: 'severity', width: 100 },
- {
- title: 'Timestamp',
- dataIndex: 'timestamp',
- width: 200,
- ellipsis: true,
- key: 'timestamp',
- },
- { title: 'Body', dataIndex: 'body', key: 'body' },
- ];
-
- useEffect(() => {
- if (eventsData?.payload?.data?.newResult?.data?.result) {
- const responsePayload =
- eventsData?.payload.data.newResult.data.result[0].list || [];
-
- const formattedData = responsePayload?.map(
- (event): EventDataType => ({
- timestamp: event.timestamp,
- severity: event.data.severity_text,
- body: event.data.body,
- id: event.data.id,
- key: event.data.id,
- resources_string: event.data.resources_string,
- attributes_string: event.data.attributes_string,
- }),
- );
-
- setFormattedPodEvents(formattedData);
-
- if (
- !responsePayload ||
- (responsePayload &&
- isArray(responsePayload) &&
- responsePayload.length < EventsPageSize)
- ) {
- setHasReachedEndOfEvents(true);
- } else {
- setHasReachedEndOfEvents(false);
- }
- }
- }, [eventsData]);
-
- const handleExpandRow = (record: EventDataType): JSX.Element => (
- <EventContents
- data={{ ...record.attributes_string, ...record.resources_string }}
- />
- );
-
- const handlePrev = (): void => {
- if (!formattedPodEvents.length) return;
-
- setPage(page - 1);
-
- const firstEvent = formattedPodEvents[0];
-
- const newItems = [
- ...filters.items.filter((item) => item.key?.key !== 'id'),
- {
- id: v4(),
- key: {
- key: 'id',
- type: '',
- dataType: DataTypes.String,
- isColumn: true,
- },
- op: '>',
- value: firstEvent.id,
- },
- ];
-
- const newFilters = {
- op: 'AND',
- items: newItems,
- } as IBuilderQuery['filters'];
-
- handleChangeLogFilters(newFilters);
- };
-
- const handleNext = (): void => {
- if (!formattedPodEvents.length) return;
-
- setPage(page + 1);
- const lastEvent = formattedPodEvents[formattedPodEvents.length - 1];
-
- const newItems = [
- ...filters.items.filter((item) => item.key?.key !== 'id'),
- {
- id: v4(),
- key: {
- key: 'id',
- type: '',
- dataType: DataTypes.String,
- isColumn: true,
- },
- op: '<',
- value: lastEvent.id,
- },
- ];
-
- const newFilters = {
- op: 'AND',
- items: newItems,
- } as IBuilderQuery['filters'];
-
- handleChangeLogFilters(newFilters);
- };
-
- const handleExpandRowIcon = ({
- expanded,
- onExpand,
- record,
- }: {
- expanded: boolean;
- onExpand: (
- record: EventDataType,
- e: React.MouseEvent<HTMLElement, MouseEvent>,
- ) => void;
- record: EventDataType;
- }): JSX.Element =>
- expanded ? (
- <ChevronDown
- className="periscope-btn-icon"
- size={14}
- onClick={(e): void =>
- onExpand(
- record,
- (e as unknown) as React.MouseEvent<HTMLElement, MouseEvent>,
- )
- }
- />
- ) : (
- <ChevronRight
- className="periscope-btn-icon"
- size={14}
- // eslint-disable-next-line sonarjs/no-identical-functions
- onClick={(e): void =>
- onExpand(
- record,
- (e as unknown) as React.MouseEvent<HTMLElement, MouseEvent>,
- )
- }
- />
- );
-
- return (
- <div className="pod-events-container">
- <div className="pod-events-header">
- <div className="filter-section">
- {query && (
- <QueryBuilderSearch
- query={query}
- onChange={handleChangeLogFilters}
- disableNavigationShortcuts
- />
- )}
- </div>
- <div className="datetime-section">
- <DateTimeSelectionV2
- showAutoRefresh={false}
- showRefreshText={false}
- hideShareModal
- isModalTimeSelection={isModalTimeSelection}
- onTimeChange={handleTimeChange}
- defaultRelativeTime="5m"
- modalSelectedInterval={selectedInterval}
- />
- </div>
- </div>
-
- {isLoading && <LoadingContainer />}
-
- {!isLoading && !isError && formattedPodEvents.length === 0 && (
- <NoEventsContainer />
- )}
-
- {isError && !isLoading && <LogsError />}
-
- {!isLoading && !isError && formattedPodEvents.length > 0 && (
- <div className="pod-events-list-container">
- <div className="pod-events-list-card">
- <Table<EventDataType>
- loading={isLoading && page > 1}
- columns={columns}
- expandable={{
- expandedRowRender: handleExpandRow,
- rowExpandable: (record): boolean => record.body !== 'Not Expandable',
- expandIcon: handleExpandRowIcon,
- }}
- dataSource={formattedPodEvents}
- pagination={false}
- rowKey={(record): string => record.id}
- />
- </div>
- </div>
- )}
-
- {!isError && formattedPodEvents.length > 0 && (
- <div className="pod-events-footer">
- <Button
- className="pod-events-footer-button periscope-btn ghost"
- type="link"
- onClick={handlePrev}
- disabled={page === 1 || isFetching || isLoading}
- >
- {!isFetching && <ChevronLeft size={14} />}
- Prev
- </Button>
-
- <Button
- className="pod-events-footer-button periscope-btn ghost"
- type="link"
- onClick={handleNext}
- disabled={hasReachedEndOfEvents || isFetching || isLoading}
- >
- Next
- {!isFetching && <ChevronRight size={14} />}
- </Button>
-
- {(isFetching || isLoading) && (
- <Loader2 className="animate-spin" size={16} color={Color.BG_ROBIN_500} />
- )}
- </div>
- )}
- </div>
- );
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/NoEventsContainer.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/NoEventsContainer.tsx
deleted file mode 100644
index 006ac4b437..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/NoEventsContainer.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Color } from '@signozhq/design-tokens';
-import { Typography } from 'antd';
-import { Ghost } from 'lucide-react';
-
-const { Text } = Typography;
-
-export default function NoEventsContainer(): React.ReactElement {
- return (
- <div className="no-logs-found">
- <Text type="secondary">
- <Ghost size={24} color={Color.BG_AMBER_500} /> No events found for this pod
- in the selected time range.
- </Text>
- </div>
- );
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/constants.ts
deleted file mode 100644
index 7b434effa9..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/Events/constants.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 as uuidv4 } from 'uuid';
-
-export const getPodsEventsQueryPayload = (
- start: number,
- end: number,
- filters: IBuilderQuery['filters'],
-): GetQueryResultsProps => ({
- graphType: PANEL_TYPES.LIST,
- selectedTime: 'GLOBAL_TIME',
- query: {
- clickhouse_sql: [],
- promql: [],
- builder: {
- queryData: [
- {
- dataSource: DataSource.LOGS,
- queryName: 'A',
- aggregateOperator: 'noop',
- aggregateAttribute: {
- id: '------false',
- dataType: DataTypes.String,
- key: '',
- isColumn: false,
- type: '',
- isJSON: false,
- },
- timeAggregation: 'rate',
- spaceAggregation: 'sum',
- functions: [],
- filters,
- expression: 'A',
- disabled: false,
- stepInterval: 60,
- having: [],
- limit: null,
- orderBy: [
- {
- columnName: 'timestamp',
- order: 'desc',
- },
- ],
- groupBy: [],
- legend: '',
- reduceTo: 'avg',
- offset: 0,
- pageSize: 100,
- },
- ],
- queryFormulas: [],
- },
- id: uuidv4(),
- queryType: EQueryType.QUERY_BUILDER,
- },
- params: {
- lastLogLineTimestamp: null,
- },
- start,
- end,
-});
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
index d13207106f..49bf0caa34 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodDetails.tsx
@@ -1,11 +1,12 @@
/* eslint-disable sonarjs/no-identical-functions */
/* eslint-disable sonarjs/no-duplicate-string */
-import './PodDetails.styles.scss';
+import '../../EntityDetailsUtils/entityDetails.styles.scss';
import { Color, Spacing } from '@signozhq/design-tokens';
import { Button, Divider, Drawer, Radio, Tooltip, Typography } from 'antd';
import { RadioChangeEvent } from 'antd/lib';
import logEvent from 'api/common/logEvent';
+import { K8sPodsData } from 'api/infraMonitoring/getK8sPodsList';
import { VIEW_TYPES, VIEWS } from 'components/HostMetricsDetail/constants';
import { QueryParams } from 'constants/query';
import {
@@ -13,7 +14,9 @@ import {
initialQueryState,
} from 'constants/queryBuilder';
import ROUTES from 'constants/routes';
-import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/entityDetailUtils';
+import { filterDuplicateFilters } from 'container/InfraMonitoringK8s/commonUtils';
+import { K8sCategory } from 'container/InfraMonitoringK8s/constants';
+import { QUERY_KEYS } from 'container/InfraMonitoringK8s/EntityDetailsUtils/utils';
import {
CustomTimeType,
Time,
@@ -44,12 +47,12 @@ import {
import { GlobalReducer } from 'types/reducer/globalTime';
import { v4 as uuidv4 } from 'uuid';
-import { QUERY_KEYS } from './constants';
-import Events from './Events/Events';
-import Metrics from './Metrics/Metrics';
+import PodEvents from '../../EntityDetailsUtils/EntityEvents';
+import PodLogs from '../../EntityDetailsUtils/EntityLogs';
+import PodMetrics from '../../EntityDetailsUtils/EntityMetrics';
+import PodTraces from '../../EntityDetailsUtils/EntityTraces';
+import { getPodMetricsQueryPayload, podWidgetInfo } from './constants';
import { PodDetailProps } from './PodDetail.interfaces';
-import PodLogsDetailedView from './PodLogs/PodLogsDetailedView';
-import PodTraces from './PodTraces/PodTraces';
const TimeRangeOffset = 1000000000;
@@ -423,49 +426,49 @@ function PodDetails({
overscrollBehavior: 'contain',
background: isDarkMode ? Color.BG_INK_400 : Color.BG_VANILLA_100,
}}
- className="pod-detail-drawer"
+ className="entity-detail-drawer"
destroyOnClose
closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
>
{pod && (
<>
- <div className="pod-detail-drawer__pod">
- <div className="pod-details-grid">
+ <div className="entity-detail-drawer__entity">
+ <div className="entity-details-grid">
<div className="labels-row">
<Typography.Text
type="secondary"
- className="pod-details-metadata-label"
+ className="entity-details-metadata-label"
>
NAMESPACE
</Typography.Text>
<Typography.Text
type="secondary"
- className="pod-details-metadata-label"
+ className="entity-details-metadata-label"
>
Cluster Name
</Typography.Text>
<Typography.Text
type="secondary"
- className="pod-details-metadata-label"
+ className="entity-details-metadata-label"
>
Node
</Typography.Text>
</div>
<div className="values-row">
- <Typography.Text className="pod-details-metadata-value">
+ <Typography.Text className="entity-details-metadata-value">
<Tooltip title={pod.meta.k8s_namespace_name}>
{pod.meta.k8s_namespace_name}
</Tooltip>
</Typography.Text>
- <Typography.Text className="pod-details-metadata-value">
+ <Typography.Text className="entity-details-metadata-value">
<Tooltip title={pod.meta.k8s_cluster_name}>
{pod.meta.k8s_cluster_name}
</Tooltip>
</Typography.Text>
- <Typography.Text className="pod-details-metadata-value">
+ <Typography.Text className="entity-details-metadata-value">
<Tooltip title={pod.meta.k8s_node_name}>
{pod.meta.k8s_node_name}
</Tooltip>
@@ -538,22 +541,33 @@ function PodDetails({
</div>
{selectedView === VIEW_TYPES.METRICS && (
- <Metrics
- pod={pod}
+ <PodMetrics<K8sPodsData>
+ entity={pod}
selectedInterval={selectedInterval}
timeRange={modalTimeRange}
handleTimeChange={handleTimeChange}
isModalTimeSelection={isModalTimeSelection}
+ entityWidgetInfo={podWidgetInfo}
+ getEntityQueryPayload={getPodMetricsQueryPayload}
+ category={K8sCategory.PODS}
+ queryKey="podMetrics"
/>
)}
{selectedView === VIEW_TYPES.LOGS && (
- <PodLogsDetailedView
+ <PodLogs
timeRange={modalTimeRange}
isModalTimeSelection={isModalTimeSelection}
handleTimeChange={handleTimeChange}
handleChangeLogFilters={handleChangeLogFilters}
logFilters={logFilters}
selectedInterval={selectedInterval}
+ queryKeyFilters={[
+ QUERY_KEYS.K8S_POD_NAME,
+ QUERY_KEYS.K8S_CLUSTER_NAME,
+ QUERY_KEYS.K8S_NAMESPACE_NAME,
+ ]}
+ queryKey="podLogs"
+ category={K8sCategory.PODS}
/>
)}
{selectedView === VIEW_TYPES.TRACES && (
@@ -564,17 +578,20 @@ function PodDetails({
handleChangeTracesFilters={handleChangeTracesFilters}
tracesFilters={tracesFilters}
selectedInterval={selectedInterval}
+ queryKey="podTraces"
/>
)}
{selectedView === VIEW_TYPES.EVENTS && (
- <Events
+ <PodEvents
timeRange={modalTimeRange}
isModalTimeSelection={isModalTimeSelection}
handleTimeChange={handleTimeChange}
- handleChangeLogFilters={handleChangeEventsFilters}
+ handleChangeEventFilters={handleChangeEventsFilters}
filters={eventsFilters}
selectedInterval={selectedInterval}
+ category={K8sCategory.PODS}
+ queryKey="podEvents"
/>
)}
</>
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/NoLogsContainer.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/NoLogsContainer.tsx
deleted file mode 100644
index b46213cbf3..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/NoLogsContainer.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Color } from '@signozhq/design-tokens';
-import { Typography } from 'antd';
-import { Ghost } from 'lucide-react';
-
-const { Text } = Typography;
-
-export default function NoLogsContainer(): React.ReactElement {
- return (
- <div className="no-logs-found">
- <Text type="secondary">
- <Ghost size={24} color={Color.BG_AMBER_500} /> No logs found for this pod in
- the selected time range.
- </Text>
- </div>
- );
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.styles.scss b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.styles.scss
deleted file mode 100644
index b65cf1446e..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.styles.scss
+++ /dev/null
@@ -1,133 +0,0 @@
-.pod-logs-container {
- margin-top: 1rem;
-
- .filter-section {
- flex: 1;
-
- .ant-select-selector {
- border-radius: 2px;
- border: 1px solid var(--bg-slate-400) !important;
- background-color: var(--bg-ink-300) !important;
-
- input {
- font-size: 12px;
- }
-
- .ant-tag .ant-typography {
- font-size: 12px;
- }
- }
- }
-
- .pod-logs-header {
- display: flex;
- justify-content: space-between;
- gap: 8px;
-
- padding: 12px;
- border-radius: 3px;
- border: 1px solid var(--bg-slate-500);
- }
-
- .pod-logs {
- margin-top: 1rem;
-
- .virtuoso-list {
- overflow-y: hidden !important;
-
- &::-webkit-scrollbar {
- width: 0.3rem;
- height: 0.3rem;
- }
-
- &::-webkit-scrollbar-track {
- background: transparent;
- }
-
- &::-webkit-scrollbar-thumb {
- background: var(--bg-slate-300);
- }
-
- &::-webkit-scrollbar-thumb:hover {
- background: var(--bg-slate-200);
- }
-
- .ant-row {
- width: fit-content;
- }
- }
-
- .skeleton-container {
- height: 100%;
- padding: 16px;
- }
- }
-}
-
-.pod-logs-list-container {
- flex: 1;
- height: calc(100vh - 272px) !important;
- display: flex;
- height: 100%;
-
- .raw-log-content {
- width: 100%;
- text-wrap: inherit;
- word-wrap: break-word;
- }
-}
-
-.pod-logs-list-card {
- width: 100%;
- margin-top: 12px;
-
- .ant-card-body {
- padding: 0;
-
- height: 100%;
- width: 100%;
- }
-}
-
-.logs-loading-skeleton {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 8px;
- padding: 8px 0;
-
- .ant-skeleton-input-sm {
- height: 18px;
- }
-}
-
-.no-logs-found {
- height: 50vh;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- padding: 24px;
- box-sizing: border-box;
-
- .ant-typography {
- display: flex;
- align-items: center;
- gap: 16px;
- }
-}
-
-.lightMode {
- .filter-section {
- border-top: 1px solid var(--bg-vanilla-300);
- border-bottom: 1px solid var(--bg-vanilla-300);
-
- .ant-select-selector {
- border-color: var(--bg-vanilla-300) !important;
- background-color: var(--bg-vanilla-100) !important;
- color: var(--bg-ink-200);
- }
- }
-}
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.tsx
deleted file mode 100644
index 2ed0a9858b..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogs.tsx
+++ /dev/null
@@ -1,218 +0,0 @@
-/* eslint-disable no-nested-ternary */
-import './PodLogs.styles.scss';
-
-import { Card } from 'antd';
-import RawLogView from 'components/Logs/RawLogView';
-import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
-import { DEFAULT_ENTITY_VERSION } from 'constants/app';
-import LogsError from 'container/LogsError/LogsError';
-import { LogsLoading } from 'container/LogsLoading/LogsLoading';
-import { FontSize } from 'container/OptionsMenu/types';
-import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
-import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
-import { isEqual } from 'lodash-es';
-import { useCallback, useEffect, useMemo, useState } from 'react';
-import { useQuery } from 'react-query';
-import { Virtuoso } from 'react-virtuoso';
-import { ILog } from 'types/api/logs/log';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import {
- IBuilderQuery,
- TagFilterItem,
-} from 'types/api/queryBuilder/queryBuilderData';
-import { v4 } from 'uuid';
-
-import { QUERY_KEYS } from '../constants';
-import { getPodLogsQueryPayload } from './constants';
-import NoLogsContainer from './NoLogsContainer';
-
-interface Props {
- timeRange: {
- startTime: number;
- endTime: number;
- };
- handleChangeLogFilters: (filters: IBuilderQuery['filters']) => void;
- filters: IBuilderQuery['filters'];
-}
-
-function PodLogs({
- timeRange,
- handleChangeLogFilters,
- filters,
-}: Props): JSX.Element {
- const [logs, setLogs] = useState<ILog[]>([]);
- const [hasReachedEndOfLogs, setHasReachedEndOfLogs] = useState(false);
- const [restFilters, setRestFilters] = useState<TagFilterItem[]>([]);
- const [resetLogsList, setResetLogsList] = useState<boolean>(false);
-
- useEffect(() => {
- const newRestFilters = filters.items.filter(
- (item) =>
- item.key?.key !== 'id' &&
- ![
- QUERY_KEYS.K8S_POD_NAME,
- QUERY_KEYS.K8S_CLUSTER_NAME,
- QUERY_KEYS.K8S_NAMESPACE_NAME,
- ].includes(item.key?.key || ''),
- );
-
- const areFiltersSame = isEqual(restFilters, newRestFilters);
-
- if (!areFiltersSame) {
- setResetLogsList(true);
- }
-
- setRestFilters(newRestFilters);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [filters]);
-
- const queryPayload = useMemo(() => {
- const basePayload = getPodLogsQueryPayload(
- timeRange.startTime,
- timeRange.endTime,
- filters,
- );
-
- basePayload.query.builder.queryData[0].pageSize = 100;
- basePayload.query.builder.queryData[0].orderBy = [
- { columnName: 'timestamp', order: ORDERBY_FILTERS.DESC },
- ];
-
- return basePayload;
- }, [timeRange.startTime, timeRange.endTime, filters]);
-
- const [isPaginating, setIsPaginating] = useState(false);
-
- const { data, isLoading, isFetching, isError } = useQuery({
- queryKey: ['podLogs', timeRange.startTime, timeRange.endTime, filters],
- queryFn: () => GetMetricQueryRange(queryPayload, DEFAULT_ENTITY_VERSION),
- enabled: !!queryPayload,
- keepPreviousData: isPaginating,
- });
-
- useEffect(() => {
- if (data?.payload?.data?.newResult?.data?.result) {
- const currentData = data.payload.data.newResult.data.result;
-
- if (resetLogsList) {
- const currentLogs: ILog[] =
- currentData[0].list?.map((item) => ({
- ...item.data,
- timestamp: item.timestamp,
- })) || [];
-
- setLogs(currentLogs);
-
- setResetLogsList(false);
- }
-
- if (currentData.length > 0 && currentData[0].list) {
- const currentLogs: ILog[] =
- currentData[0].list.map((item) => ({
- ...item.data,
- timestamp: item.timestamp,
- })) || [];
-
- setLogs((prev) => [...prev, ...currentLogs]);
- } else {
- setHasReachedEndOfLogs(true);
- }
- }
- }, [data, restFilters, isPaginating, resetLogsList]);
-
- const getItemContent = useCallback(
- (_: number, logToRender: ILog): JSX.Element => (
- <RawLogView
- isReadOnly
- isTextOverflowEllipsisDisabled
- key={logToRender.id}
- data={logToRender}
- linesPerRow={5}
- fontSize={FontSize.MEDIUM}
- />
- ),
- [],
- );
-
- const loadMoreLogs = useCallback(() => {
- if (!logs.length) return;
-
- setIsPaginating(true);
- const lastLog = logs[logs.length - 1];
-
- const newItems = [
- ...filters.items.filter((item) => item.key?.key !== 'id'),
- {
- id: v4(),
- key: {
- key: 'id',
- type: '',
- dataType: DataTypes.String,
- isColumn: true,
- },
- op: '<',
- value: lastLog.id,
- },
- ];
-
- const newFilters = {
- op: 'AND',
- items: newItems,
- } as IBuilderQuery['filters'];
-
- handleChangeLogFilters(newFilters);
- }, [logs, filters, handleChangeLogFilters]);
-
- useEffect(() => {
- setIsPaginating(false);
- }, [data]);
-
- const renderFooter = useCallback(
- (): JSX.Element | null => (
- // eslint-disable-next-line react/jsx-no-useless-fragment
- <>
- {isFetching ? (
- <div className="logs-loading-skeleton"> Loading more logs ... </div>
- ) : hasReachedEndOfLogs ? (
- <div className="logs-loading-skeleton"> *** End *** </div>
- ) : null}
- </>
- ),
- [isFetching, hasReachedEndOfLogs],
- );
-
- const renderContent = useMemo(
- () => (
- <Card bordered={false} className="pod-logs-list-card">
- <OverlayScrollbar isVirtuoso>
- <Virtuoso
- className="pod-logs-virtuoso"
- key="pod-logs-virtuoso"
- data={logs}
- endReached={loadMoreLogs}
- totalCount={logs.length}
- itemContent={getItemContent}
- overscan={200}
- components={{
- Footer: renderFooter,
- }}
- />
- </OverlayScrollbar>
- </Card>
- ),
- [logs, loadMoreLogs, getItemContent, renderFooter],
- );
-
- return (
- <div className="pod-logs">
- {isLoading && <LogsLoading />}
- {!isLoading && !isError && logs.length === 0 && <NoLogsContainer />}
- {isError && !isLoading && <LogsError />}
- {!isLoading && !isError && logs.length > 0 && (
- <div className="pod-logs-list-container">{renderContent}</div>
- )}
- </div>
- );
-}
-
-export default PodLogs;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogsDetailedView.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogsDetailedView.tsx
deleted file mode 100644
index 69e22c1c6c..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/PodLogsDetailedView.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import './PodLogs.styles.scss';
-
-import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch';
-import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
-import {
- CustomTimeType,
- Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
-import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { useMemo } from 'react';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { DataSource } from 'types/common/queryBuilder';
-
-import PodLogs from './PodLogs';
-
-interface Props {
- timeRange: {
- startTime: number;
- endTime: number;
- };
- isModalTimeSelection: boolean;
- handleTimeChange: (
- interval: Time | CustomTimeType,
- dateTimeRange?: [number, number],
- ) => void;
- handleChangeLogFilters: (value: IBuilderQuery['filters']) => void;
- logFilters: IBuilderQuery['filters'];
- selectedInterval: Time;
-}
-
-function PodLogsDetailedView({
- timeRange,
- isModalTimeSelection,
- handleTimeChange,
- handleChangeLogFilters,
- logFilters,
- selectedInterval,
-}: Props): JSX.Element {
- const { currentQuery } = useQueryBuilder();
- const updatedCurrentQuery = useMemo(
- () => ({
- ...currentQuery,
- builder: {
- ...currentQuery.builder,
- queryData: [
- {
- ...currentQuery.builder.queryData[0],
- dataSource: DataSource.LOGS,
- aggregateOperator: 'noop',
- aggregateAttribute: {
- ...currentQuery.builder.queryData[0].aggregateAttribute,
- },
- filters: {
- items: [],
- op: 'AND',
- },
- },
- ],
- },
- }),
- [currentQuery],
- );
-
- const query = updatedCurrentQuery?.builder?.queryData[0] || null;
-
- return (
- <div className="host-metrics-logs-container">
- <div className="host-metrics-logs-header">
- <div className="filter-section">
- {query && (
- <QueryBuilderSearch
- query={query}
- onChange={handleChangeLogFilters}
- disableNavigationShortcuts
- />
- )}
- </div>
- <div className="datetime-section">
- <DateTimeSelectionV2
- showAutoRefresh={false}
- showRefreshText={false}
- hideShareModal
- isModalTimeSelection={isModalTimeSelection}
- onTimeChange={handleTimeChange}
- defaultRelativeTime="5m"
- modalSelectedInterval={selectedInterval}
- />
- </div>
- </div>
- <PodLogs
- timeRange={timeRange}
- handleChangeLogFilters={handleChangeLogFilters}
- filters={logFilters}
- />
- </div>
- );
-}
-
-export default PodLogsDetailedView;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/constants.ts
deleted file mode 100644
index 00a09f7d16..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodLogs/constants.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 as uuidv4 } from 'uuid';
-
-export const getPodLogsQueryPayload = (
- start: number,
- end: number,
- filters: IBuilderQuery['filters'],
-): GetQueryResultsProps => ({
- graphType: PANEL_TYPES.LIST,
- selectedTime: 'GLOBAL_TIME',
- query: {
- clickhouse_sql: [],
- promql: [],
- builder: {
- queryData: [
- {
- dataSource: DataSource.LOGS,
- queryName: 'A',
- aggregateOperator: 'noop',
- aggregateAttribute: {
- id: '------false',
- dataType: DataTypes.String,
- key: '',
- isColumn: false,
- type: '',
- isJSON: false,
- },
- timeAggregation: 'rate',
- spaceAggregation: 'sum',
- functions: [],
- filters,
- expression: 'A',
- disabled: false,
- stepInterval: 60,
- having: [],
- limit: null,
- orderBy: [
- {
- columnName: 'timestamp',
- order: 'desc',
- },
- ],
- groupBy: [],
- legend: '',
- reduceTo: 'avg',
- offset: 0,
- pageSize: 100,
- },
- ],
- queryFormulas: [],
- },
- id: uuidv4(),
- queryType: EQueryType.QUERY_BUILDER,
- },
- params: {
- lastLogLineTimestamp: null,
- },
- start,
- end,
-});
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.tsx
deleted file mode 100644
index 53b12908c8..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/PodTraces/PodTraces.tsx
+++ /dev/null
@@ -1,199 +0,0 @@
-import './PodTraces.styles.scss';
-
-import { getListColumns } from 'components/HostMetricsDetail/HostMetricTraces/utils';
-import { ResizeTable } from 'components/ResizeTable';
-import { DEFAULT_ENTITY_VERSION } from 'constants/app';
-import { QueryParams } from 'constants/query';
-import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
-import NoLogs from 'container/NoLogs/NoLogs';
-import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch';
-import { ErrorText } from 'container/TimeSeriesView/styles';
-import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
-import {
- CustomTimeType,
- Time,
-} from 'container/TopNav/DateTimeSelectionV2/config';
-import TraceExplorerControls from 'container/TracesExplorer/Controls';
-import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
-import { TracesLoading } from 'container/TracesExplorer/TraceLoading/TraceLoading';
-import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
-import { Pagination } from 'hooks/queryPagination';
-import useUrlQueryData from 'hooks/useUrlQueryData';
-import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
-import { useEffect, useMemo, useState } from 'react';
-import { useQuery } from 'react-query';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { DataSource } from 'types/common/queryBuilder';
-
-import { getPodTracesQueryPayload, selectedColumns } from './constants';
-
-interface Props {
- timeRange: {
- startTime: number;
- endTime: number;
- };
- isModalTimeSelection: boolean;
- handleTimeChange: (
- interval: Time | CustomTimeType,
- dateTimeRange?: [number, number],
- ) => void;
- handleChangeTracesFilters: (value: IBuilderQuery['filters']) => void;
- tracesFilters: IBuilderQuery['filters'];
- selectedInterval: Time;
-}
-
-function PodTraces({
- timeRange,
- isModalTimeSelection,
- handleTimeChange,
- handleChangeTracesFilters,
- tracesFilters,
- selectedInterval,
-}: Props): JSX.Element {
- const [traces, setTraces] = useState<any[]>([]);
- const [offset] = useState<number>(0);
-
- const { currentQuery } = useQueryBuilder();
- const updatedCurrentQuery = useMemo(
- () => ({
- ...currentQuery,
- builder: {
- ...currentQuery.builder,
- queryData: [
- {
- ...currentQuery.builder.queryData[0],
- dataSource: DataSource.TRACES,
- aggregateOperator: 'noop',
- aggregateAttribute: {
- ...currentQuery.builder.queryData[0].aggregateAttribute,
- },
- filters: {
- items: [],
- op: 'AND',
- },
- },
- ],
- },
- }),
- [currentQuery],
- );
-
- const query = updatedCurrentQuery?.builder?.queryData[0] || null;
-
- const { queryData: paginationQueryData } = useUrlQueryData<Pagination>(
- QueryParams.pagination,
- );
-
- const queryPayload = useMemo(
- () =>
- getPodTracesQueryPayload(
- timeRange.startTime,
- timeRange.endTime,
- paginationQueryData?.offset || offset,
- tracesFilters,
- ),
- [
- timeRange.startTime,
- timeRange.endTime,
- offset,
- tracesFilters,
- paginationQueryData,
- ],
- );
-
- const { data, isLoading, isFetching, isError } = useQuery({
- queryKey: [
- 'podTraces',
- timeRange.startTime,
- timeRange.endTime,
- offset,
- tracesFilters,
- DEFAULT_ENTITY_VERSION,
- paginationQueryData,
- ],
- queryFn: () => GetMetricQueryRange(queryPayload, DEFAULT_ENTITY_VERSION),
- enabled: !!queryPayload,
- });
-
- const traceListColumns = getListColumns(selectedColumns);
-
- useEffect(() => {
- if (data?.payload?.data?.newResult?.data?.result) {
- const currentData = data.payload.data.newResult.data.result;
- if (currentData.length > 0 && currentData[0].list) {
- if (offset === 0) {
- setTraces(currentData[0].list ?? []);
- } else {
- setTraces((prev) => [...prev, ...(currentData[0].list ?? [])]);
- }
- }
- }
- }, [data, offset]);
-
- const isDataEmpty =
- !isLoading && !isFetching && !isError && traces.length === 0;
- const hasAdditionalFilters = tracesFilters.items.length > 1;
-
- const totalCount =
- data?.payload?.data?.newResult?.data?.result?.[0]?.list?.length || 0;
-
- return (
- <div className="host-metric-traces">
- <div className="host-metric-traces-header">
- <div className="filter-section">
- {query && (
- <QueryBuilderSearch
- query={query}
- onChange={handleChangeTracesFilters}
- disableNavigationShortcuts
- />
- )}
- </div>
- <div className="datetime-section">
- <DateTimeSelectionV2
- showAutoRefresh={false}
- showRefreshText={false}
- hideShareModal
- isModalTimeSelection={isModalTimeSelection}
- onTimeChange={handleTimeChange}
- defaultRelativeTime="5m"
- modalSelectedInterval={selectedInterval}
- />
- </div>
- </div>
-
- {isError && <ErrorText>{data?.error || 'Something went wrong'}</ErrorText>}
-
- {isLoading && traces.length === 0 && <TracesLoading />}
-
- {isDataEmpty && !hasAdditionalFilters && (
- <NoLogs dataSource={DataSource.TRACES} />
- )}
-
- {isDataEmpty && hasAdditionalFilters && (
- <EmptyLogsSearch dataSource={DataSource.TRACES} panelType="LIST" />
- )}
-
- {!isError && traces.length > 0 && (
- <div className="pod-traces-table">
- <TraceExplorerControls
- isLoading={isFetching}
- totalCount={totalCount}
- perPageOptions={PER_PAGE_OPTIONS}
- showSizeChanger={false}
- />
- <ResizeTable
- tableLayout="fixed"
- pagination={false}
- scroll={{ x: true }}
- loading={isFetching}
- dataSource={traces}
- columns={traceListColumns}
- />
- </div>
- )}
- </div>
- );
-}
-
-export default PodTraces;
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts
index 6a9b1f852f..4f8579af71 100644
--- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts
@@ -1,7 +1,2672 @@
-export const QUERY_KEYS = {
- K8S_OBJECT_KIND: 'k8s.object.kind',
- K8S_OBJECT_NAME: 'k8s.object.name',
- K8S_POD_NAME: 'k8s.pod.name',
- K8S_NAMESPACE_NAME: 'k8s.namespace.name',
- K8S_CLUSTER_NAME: 'k8s.cluster.name',
-};
+/* eslint-disable sonarjs/no-duplicate-string */
+import { K8sPodsData } from 'api/infraMonitoring/getK8sPodsList';
+import { PANEL_TYPES } from 'constants/queryBuilder';
+import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
+import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
+import { EQueryType } from 'types/common/dashboard';
+import { DataSource } from 'types/common/queryBuilder';
+import { v4 } from 'uuid';
+
+export const podWidgetInfo = [
+ {
+ title: 'CPU Usage (cores)',
+ yAxisUnit: '',
+ },
+ {
+ title: 'CPU Request, Limit Utilization',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Memory Usage (bytes)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Memory Request, Limit Utilization',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Memory by State',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Memory Major Page Faults',
+ yAxisUnit: '',
+ },
+ {
+ title: 'CPU Usage by Container (cores)',
+ yAxisUnit: '',
+ },
+ {
+ title: 'CPU Request, Limit Utilization by Container',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Memory Usage by Container (bytes)',
+ yAxisUnit: 'bytes',
+ },
+ {
+ title: 'Memory Request, Limit Utilization by Container',
+ yAxisUnit: 'percentunit',
+ },
+ {
+ title: 'Network rate',
+ yAxisUnit: 'binBps',
+ },
+ {
+ title: 'Network errors',
+ yAxisUnit: '',
+ },
+ {
+ title: 'File system (bytes)',
+ yAxisUnit: 'bytes',
+ },
+];
+
+export const getPodMetricsQueryPayload = (
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'container_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'fdf017be',
+ 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: '4b4382be',
+ 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: '{{k8s_container_name}}',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'container_cpu_utilization--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_cpu_utilization',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'f0c71cba',
+ 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: '9301d7c0',
+ 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: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_cpu_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_cpu_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: '9b14868b',
+ 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: '92b99374',
+ 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: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ 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',
+ },
+ ],
+ },
+ 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: 'container_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'e8914a2d',
+ 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: '964fd905',
+ 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: 'usage :: {{k8s_container_name}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'container_memory_working_set--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_memory_working_set',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'a2f69b5d',
+ 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: '76a586be',
+ 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: 'working set :: {{k8s_container_name}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'container_memory_rss--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_memory_rss',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: '95fc86d1',
+ 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: '7c5f875b',
+ 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: 'rss :: {{k8s_container_name}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ 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,
+ query: {
+ builder: {
+ queryData: [
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'container_memory_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'container_memory_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: 'c2d56c31',
+ 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: '80216712',
+ 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: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_request--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_request',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'c04e7733',
+ 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: '84b59a9f',
+ 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: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'max',
+ stepInterval: 60,
+ timeAggregation: 'latest',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_container_memory_limit--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_container_memory_limit',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'latest',
+ dataSource: DataSource.METRICS,
+ disabled: true,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'd1549857',
+ 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: 'd649ad0c',
+ 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',
+ },
+ ],
+ },
+ 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_network_io--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_network_io',
+ type: 'Sum',
+ },
+ aggregateOperator: 'rate',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '29bc6602',
+ 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: 'bc9c5cf3',
+ 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: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'rate',
+ },
+ ],
+ 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_network_errors--float64--Sum--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_network_errors',
+ type: 'Sum',
+ },
+ aggregateOperator: 'increase',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '200e722b',
+ 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: 'b54a3d78',
+ 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: 'interface--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'interface',
+ type: 'tag',
+ },
+ {
+ dataType: DataTypes.String,
+ id: 'direction--string--tag--false',
+ isColumn: false,
+ isJSON: false,
+ key: 'direction',
+ type: 'tag',
+ },
+ ],
+ having: [],
+ legend: '{{direction}} :: {{interface}}',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'increase',
+ },
+ ],
+ 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_filesystem_capacity--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_filesystem_capacity',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'A',
+ filters: {
+ items: [
+ {
+ id: '779f7a2e',
+ 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: '1a97cb95',
+ 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: 'Capacity',
+ limit: null,
+ orderBy: [],
+ queryName: 'A',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_pod_filesystem_available--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_filesystem_available',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'B',
+ filters: {
+ items: [
+ {
+ id: 'dd756bfe',
+ 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: 'ddfbd379',
+ 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: 'Available',
+ limit: null,
+ orderBy: [],
+ queryName: 'B',
+ reduceTo: 'avg',
+ spaceAggregation: 'sum',
+ stepInterval: 60,
+ timeAggregation: 'avg',
+ },
+ {
+ aggregateAttribute: {
+ dataType: DataTypes.Float64,
+ id: 'k8s_pod_filesystem_usage--float64--Gauge--true',
+ isColumn: true,
+ isJSON: false,
+ key: 'k8s_pod_filesystem_usage',
+ type: 'Gauge',
+ },
+ aggregateOperator: 'avg',
+ dataSource: DataSource.METRICS,
+ disabled: false,
+ expression: 'C',
+ filters: {
+ items: [
+ {
+ id: 'a5ac4705',
+ 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: '1963fc96',
+ 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: 'Uage',
+ limit: null,
+ orderBy: [],
+ queryName: 'C',
+ 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,
+ },
+];
diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts
deleted file mode 100644
index 7a18381c93..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/Pods/constants.ts
+++ /dev/null
@@ -1,2672 +0,0 @@
-/* eslint-disable sonarjs/no-duplicate-string */
-import { K8sPodsData } from 'api/infraMonitoring/getK8sPodsList';
-import { PANEL_TYPES } from 'constants/queryBuilder';
-import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
-import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { EQueryType } from 'types/common/dashboard';
-import { DataSource } from 'types/common/queryBuilder';
-import { v4 } from 'uuid';
-
-export const podWidgetInfo = [
- {
- title: 'CPU Usage (cores)',
- yAxisUnit: '',
- },
- {
- title: 'CPU Request, Limit Utilization',
- yAxisUnit: 'percentunit',
- },
- {
- title: 'Memory Usage (bytes)',
- yAxisUnit: 'bytes',
- },
- {
- title: 'Memory Request, Limit Utilization',
- yAxisUnit: 'percentunit',
- },
- {
- title: 'Memory by State',
- yAxisUnit: 'bytes',
- },
- {
- title: 'Memory Major Page Faults',
- yAxisUnit: '',
- },
- {
- title: 'CPU Usage by Container (cores)',
- yAxisUnit: '',
- },
- {
- title: 'CPU Request, Limit Utilization by Container',
- yAxisUnit: 'percentunit',
- },
- {
- title: 'Memory Usage by Container (bytes)',
- yAxisUnit: 'bytes',
- },
- {
- title: 'Memory Request, Limit Utilization by Container',
- yAxisUnit: 'percentunit',
- },
- {
- 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[] => [
- {
- 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,
- query: {
- builder: {
- queryData: [
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'container_cpu_utilization--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_cpu_utilization',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'A',
- filters: {
- items: [
- {
- id: 'fdf017be',
- 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: '4b4382be',
- 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: '{{k8s_container_name}}',
- 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,
- query: {
- builder: {
- queryData: [
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'container_cpu_utilization--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_cpu_utilization',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'A',
- filters: {
- items: [
- {
- id: 'f0c71cba',
- 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: '9301d7c0',
- 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: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_container_cpu_request--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_container_cpu_request',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'B',
- filters: {
- items: [
- {
- id: '9b14868b',
- 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: '92b99374',
- 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: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'max',
- stepInterval: 60,
- 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',
- },
- ],
- },
- 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: 'container_memory_usage--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_memory_usage',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'A',
- filters: {
- items: [
- {
- id: 'e8914a2d',
- 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: '964fd905',
- 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: 'usage :: {{k8s_container_name}}',
- limit: null,
- orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'container_memory_working_set--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_memory_working_set',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'B',
- filters: {
- items: [
- {
- id: 'a2f69b5d',
- 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: '76a586be',
- 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: 'working set :: {{k8s_container_name}}',
- limit: null,
- orderBy: [],
- queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'container_memory_rss--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_memory_rss',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'C',
- filters: {
- items: [
- {
- id: '95fc86d1',
- 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: '7c5f875b',
- 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: 'rss :: {{k8s_container_name}}',
- limit: null,
- orderBy: [],
- queryName: 'C',
- 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,
- query: {
- builder: {
- queryData: [
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'container_memory_usage--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'container_memory_usage',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'A',
- filters: {
- items: [
- {
- id: 'c2d56c31',
- 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: '80216712',
- 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: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_container_memory_request--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_container_memory_request',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'B',
- filters: {
- items: [
- {
- id: 'c04e7733',
- 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: '84b59a9f',
- 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: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'max',
- stepInterval: 60,
- timeAggregation: 'latest',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_container_memory_limit--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_container_memory_limit',
- type: 'Gauge',
- },
- aggregateOperator: 'latest',
- dataSource: DataSource.METRICS,
- disabled: true,
- expression: 'C',
- filters: {
- items: [
- {
- id: 'd1549857',
- 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: 'd649ad0c',
- 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',
- },
- ],
- },
- 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_network_io--float64--Sum--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_pod_network_io',
- type: 'Sum',
- },
- aggregateOperator: 'rate',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'A',
- filters: {
- items: [
- {
- id: '29bc6602',
- 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: 'bc9c5cf3',
- 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: 'interface--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'interface',
- type: 'tag',
- },
- {
- dataType: DataTypes.String,
- id: 'direction--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'direction',
- type: 'tag',
- },
- ],
- having: [],
- legend: '{{direction}} :: {{interface}}',
- limit: null,
- orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'rate',
- },
- ],
- 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_network_errors--float64--Sum--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_pod_network_errors',
- type: 'Sum',
- },
- aggregateOperator: 'increase',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'A',
- filters: {
- items: [
- {
- id: '200e722b',
- 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: 'b54a3d78',
- 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: 'interface--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'interface',
- type: 'tag',
- },
- {
- dataType: DataTypes.String,
- id: 'direction--string--tag--false',
- isColumn: false,
- isJSON: false,
- key: 'direction',
- type: 'tag',
- },
- ],
- having: [],
- legend: '{{direction}} :: {{interface}}',
- limit: null,
- orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'increase',
- },
- ],
- 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_filesystem_capacity--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_pod_filesystem_capacity',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'A',
- filters: {
- items: [
- {
- id: '779f7a2e',
- 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: '1a97cb95',
- 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: 'Capacity',
- limit: null,
- orderBy: [],
- queryName: 'A',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_pod_filesystem_available--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_pod_filesystem_available',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'B',
- filters: {
- items: [
- {
- id: 'dd756bfe',
- 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: 'ddfbd379',
- 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: 'Available',
- limit: null,
- orderBy: [],
- queryName: 'B',
- reduceTo: 'avg',
- spaceAggregation: 'sum',
- stepInterval: 60,
- timeAggregation: 'avg',
- },
- {
- aggregateAttribute: {
- dataType: DataTypes.Float64,
- id: 'k8s_pod_filesystem_usage--float64--Gauge--true',
- isColumn: true,
- isJSON: false,
- key: 'k8s_pod_filesystem_usage',
- type: 'Gauge',
- },
- aggregateOperator: 'avg',
- dataSource: DataSource.METRICS,
- disabled: false,
- expression: 'C',
- filters: {
- items: [
- {
- id: 'a5ac4705',
- 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: '1963fc96',
- 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: 'Uage',
- limit: null,
- orderBy: [],
- queryName: 'C',
- 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,
- },
-];
diff --git a/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
index e1fb2bbf4b..095a438b5c 100644
--- a/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
+++ b/frontend/src/container/InfraMonitoringK8s/commonUtils.tsx
@@ -1,14 +1,18 @@
+/* eslint-disable @typescript-eslint/no-unused-vars */
+/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable react/require-default-props */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
+/* eslint-disable prefer-destructuring */
import { Color } from '@signozhq/design-tokens';
import { Tooltip, Typography } from 'antd';
-import { ColumnsType } from 'antd/es/table';
+import Table, { ColumnsType } from 'antd/es/table';
import { Progress } from 'antd/lib';
import { ResizeTable } from 'components/ResizeTable';
import FieldRenderer from 'container/LogDetailedView/FieldRenderer';
import { DataType } from 'container/LogDetailedView/TableView';
import { useMemo } from 'react';
+import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
import { getInvalidValueTooltipText, K8sCategory } from './constants';
@@ -173,3 +177,77 @@ export function EventContents({
/>
);
}
+
+export const getMetricsTableData = (data: any): any[] => {
+ if (data?.params && data?.payload?.data?.result?.length) {
+ const rowsData = (data?.payload.data.result[0] as any).table.rows;
+ const columnsData = (data?.payload.data.result[0] as any).table.columns;
+ const builderQueries = data.params?.compositeQuery?.builderQueries;
+ const columns = columnsData.map((columnData: any) => {
+ console.log({ columnData });
+ if (columnData.isValueColumn) {
+ return {
+ key: columnData.name,
+ label: builderQueries[columnData.name].legend,
+ isValueColumn: true,
+ };
+ }
+ return {
+ key: columnData.name,
+ label: columnData.name,
+ isValueColumn: false,
+ };
+ });
+
+ const rows = rowsData.map((rowData: any) => rowData.data);
+ return [{ rows, columns }];
+ }
+ return [{ rows: [], columns: [] }];
+};
+
+export function MetricsTable({
+ rows,
+ columns,
+}: {
+ rows: any[];
+ columns: any[];
+}): JSX.Element {
+ const columnsData = columns.map((col: any) => ({
+ title: <Tooltip title={col.label}>{col.label}</Tooltip>,
+ dataIndex: col.key,
+ key: col.key,
+ sorter: false,
+ ellipsis: true,
+ render: (value: string) => <Tooltip title={value}>{value}</Tooltip>,
+ }));
+
+ return (
+ <div className="metrics-table">
+ <Table
+ dataSource={rows}
+ columns={columnsData}
+ tableLayout="fixed"
+ pagination={{ pageSize: 10, showSizeChanger: false }}
+ scroll={{ y: 180 }}
+ sticky
+ />
+ </div>
+ );
+}
+
+export const filterDuplicateFilters = (
+ filters: TagFilterItem[],
+): TagFilterItem[] => {
+ const uniqueFilters = [];
+ const seenIds = new Set();
+
+ // eslint-disable-next-line no-restricted-syntax
+ for (const filter of filters) {
+ if (!seenIds.has(filter.id)) {
+ seenIds.add(filter.id);
+ uniqueFilters.push(filter);
+ }
+ }
+
+ return uniqueFilters;
+};
diff --git a/frontend/src/container/InfraMonitoringK8s/constants.ts b/frontend/src/container/InfraMonitoringK8s/constants.ts
index e97ea61f90..c04ae05c76 100644
--- a/frontend/src/container/InfraMonitoringK8s/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/constants.ts
@@ -1,3 +1,4 @@
+/* eslint-disable sonarjs/no-duplicate-string */
import {
FiltersType,
IQuickFiltersConfig,
@@ -208,7 +209,7 @@ export const NodesQuickFiltersConfig: IQuickFiltersConfig[] = [
export const NamespaceQuickFiltersConfig: IQuickFiltersConfig[] = [
{
type: FiltersType.CHECKBOX,
- title: 'Namespace',
+ title: 'Namespace Name',
attributeKey: {
key: 'k8s_namespace_name',
dataType: DataTypes.String,
@@ -216,6 +217,24 @@ export const NamespaceQuickFiltersConfig: IQuickFiltersConfig[] = [
isColumn: false,
isJSON: false,
},
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Cluster Name',
+ attributeKey: {
+ key: 'k8s_cluster_name',
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
defaultOpen: true,
},
];
@@ -223,14 +242,17 @@ export const NamespaceQuickFiltersConfig: IQuickFiltersConfig[] = [
export const ClustersQuickFiltersConfig: IQuickFiltersConfig[] = [
{
type: FiltersType.CHECKBOX,
- title: 'Cluster',
+ title: 'Cluster Name',
attributeKey: {
- key: 'k8s.cluster.name',
+ key: 'k8s_cluster_name',
dataType: DataTypes.String,
type: 'resource',
isColumn: false,
isJSON: false,
},
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
defaultOpen: true,
},
];
@@ -268,7 +290,7 @@ export const VolumesQuickFiltersConfig: IQuickFiltersConfig[] = [
export const DeploymentsQuickFiltersConfig: IQuickFiltersConfig[] = [
{
type: FiltersType.CHECKBOX,
- title: 'Deployment',
+ title: 'Deployment Name',
attributeKey: {
key: 'k8s_deployment_name',
dataType: DataTypes.String,
@@ -276,6 +298,39 @@ export const DeploymentsQuickFiltersConfig: IQuickFiltersConfig[] = [
isColumn: false,
isJSON: false,
},
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Namespace Name',
+ attributeKey: {
+ key: 'k8s_namespace_name',
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Cluster Name',
+ attributeKey: {
+ key: 'k8s_cluster_name',
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ aggregateOperator: 'noop',
+ aggregateAttribute: 'k8s_pod_cpu_utilization',
+ dataSource: DataSource.METRICS,
defaultOpen: true,
},
];
diff --git a/frontend/src/container/InfraMonitoringK8s/entityDetailUtils.ts b/frontend/src/container/InfraMonitoringK8s/entityDetailUtils.ts
deleted file mode 100644
index 66315adb4d..0000000000
--- a/frontend/src/container/InfraMonitoringK8s/entityDetailUtils.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
-
-export const filterDuplicateFilters = (
- filters: TagFilterItem[],
-): TagFilterItem[] => {
- const uniqueFilters = [];
- const seenIds = new Set();
-
- // eslint-disable-next-line no-restricted-syntax
- for (const filter of filters) {
- if (!seenIds.has(filter.id)) {
- seenIds.add(filter.id);
- uniqueFilters.push(filter);
- }
- }
-
- return uniqueFilters;
-};
diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts
new file mode 100644
index 0000000000..9b248688c7
--- /dev/null
+++ b/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts
@@ -0,0 +1,54 @@
+import {
+ getK8sClustersList,
+ K8sClustersListPayload,
+ K8sClustersListResponse,
+} from 'api/infraMonitoring/getK8sClustersList';
+import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
+import { useMemo } from 'react';
+import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+
+type UseGetK8sClustersList = (
+ requestData: K8sClustersListPayload,
+
+ options?: UseQueryOptions<
+ SuccessResponse<K8sClustersListResponse> | ErrorResponse,
+ Error
+ >,
+
+ headers?: Record<string, string>,
+) => UseQueryResult<
+ SuccessResponse<K8sClustersListResponse> | ErrorResponse,
+ Error
+>;
+
+export const useGetK8sClustersList: UseGetK8sClustersList = (
+ requestData,
+
+ options,
+
+ headers,
+) => {
+ const queryKey = useMemo(() => {
+ if (options?.queryKey && Array.isArray(options.queryKey)) {
+ return [...options.queryKey];
+ }
+
+ if (options?.queryKey && typeof options.queryKey === 'string') {
+ return options.queryKey;
+ }
+
+ return [REACT_QUERY_KEY.GET_CLUSTER_LIST, requestData];
+ }, [options?.queryKey, requestData]);
+
+ return useQuery<
+ SuccessResponse<K8sClustersListResponse> | ErrorResponse,
+ Error
+ >({
+ queryFn: ({ signal }) => getK8sClustersList(requestData, signal, headers),
+
+ ...options,
+
+ queryKey,
+ });
+};
diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts
new file mode 100644
index 0000000000..0b075c330d
--- /dev/null
+++ b/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts
@@ -0,0 +1,48 @@
+import {
+ getK8sDeploymentsList,
+ K8sDeploymentsListPayload,
+ K8sDeploymentsListResponse,
+} from 'api/infraMonitoring/getK8sDeploymentsList';
+import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
+import { useMemo } from 'react';
+import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+
+type UseGetK8sDeploymentsList = (
+ requestData: K8sDeploymentsListPayload,
+ options?: UseQueryOptions<
+ SuccessResponse<K8sDeploymentsListResponse> | ErrorResponse,
+ Error
+ >,
+ headers?: Record<string, string>,
+) => UseQueryResult<
+ SuccessResponse<K8sDeploymentsListResponse> | ErrorResponse,
+ Error
+>;
+
+export const useGetK8sDeploymentsList: UseGetK8sDeploymentsList = (
+ requestData,
+ options,
+ headers,
+) => {
+ const queryKey = useMemo(() => {
+ if (options?.queryKey && Array.isArray(options.queryKey)) {
+ return [...options.queryKey];
+ }
+
+ if (options?.queryKey && typeof options.queryKey === 'string') {
+ return options.queryKey;
+ }
+
+ return [REACT_QUERY_KEY.GET_DEPLOYMENT_LIST, requestData];
+ }, [options?.queryKey, requestData]);
+
+ return useQuery<
+ SuccessResponse<K8sDeploymentsListResponse> | ErrorResponse,
+ Error
+ >({
+ queryFn: ({ signal }) => getK8sDeploymentsList(requestData, signal, headers),
+ ...options,
+ queryKey,
+ });
+};
diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts
new file mode 100644
index 0000000000..24763b4657
--- /dev/null
+++ b/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts
@@ -0,0 +1,48 @@
+import {
+ getK8sNamespacesList,
+ K8sNamespacesListPayload,
+ K8sNamespacesListResponse,
+} from 'api/infraMonitoring/getK8sNamespacesList';
+import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
+import { useMemo } from 'react';
+import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
+import { ErrorResponse, SuccessResponse } from 'types/api';
+
+type UseGetK8sNamespacesList = (
+ requestData: K8sNamespacesListPayload,
+ options?: UseQueryOptions<
+ SuccessResponse<K8sNamespacesListResponse> | ErrorResponse,
+ Error
+ >,
+ headers?: Record<string, string>,
+) => UseQueryResult<
+ SuccessResponse<K8sNamespacesListResponse> | ErrorResponse,
+ Error
+>;
+
+export const useGetK8sNamespacesList: UseGetK8sNamespacesList = (
+ requestData,
+ options,
+ headers,
+) => {
+ const queryKey = useMemo(() => {
+ if (options?.queryKey && Array.isArray(options.queryKey)) {
+ return [...options.queryKey];
+ }
+
+ if (options?.queryKey && typeof options.queryKey === 'string') {
+ return options.queryKey;
+ }
+
+ return [REACT_QUERY_KEY.GET_NAMESPACE_LIST, requestData];
+ }, [options?.queryKey, requestData]);
+
+ return useQuery<
+ SuccessResponse<K8sNamespacesListResponse> | ErrorResponse,
+ Error
+ >({
+ queryFn: ({ signal }) => getK8sNamespacesList(requestData, signal, headers),
+ ...options,
+ queryKey,
+ });
+};
diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts
index 4e2ac964d2..f88ffa113c 100644
--- a/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts
+++ b/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts
@@ -34,7 +34,7 @@ export const useGetK8sNodesList: UseGetK8sNodesList = (
return options.queryKey;
}
- return [REACT_QUERY_KEY.GET_HOST_LIST, requestData];
+ return [REACT_QUERY_KEY.GET_NODE_LIST, requestData];
}, [options?.queryKey, requestData]);
return useQuery<SuccessResponse<K8sNodesListResponse> | ErrorResponse, Error>({