From e83e691ef52dfc893cd65f3754c8016aa516a76e Mon Sep 17 00:00:00 2001 From: SagarRajput-7 <162284829+SagarRajput-7@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:53:19 +0530 Subject: [PATCH] feat: added celery task feature - with task graphs and details (#6840) * feat: added celery task feature - with task garphs and details * feat: added celery bar graph toggle states UI * feat: added histogram charts and right panel * feat: added task latency graph with different states * feat: added right panel trace navigation * feat: added navigateToTrace logic * feat: added value graph and global filter logic * feat: added dynamic stepinterval based on timerange * feat: changed histogram occurences to bar * feat: onclick right panels for celery state bar graphs * feat: pagesetup and tabs with kafka setup * feat: custom series for bar for color generation * feat: fixed test cases * feat: update styles --- frontend/src/AppRoutes/pageComponents.ts | 9 +- frontend/src/AppRoutes/routes.ts | 9 +- .../CeleryTaskConfigOptions.styles.scss | 39 + .../CeleryTaskConfigOptions.tsx | 92 ++ .../useGetCeleryFilters.ts | 49 + .../CeleryTaskDetail.style.scss | 74 ++ .../CeleryTaskDetail/CeleryTaskDetail.tsx | 230 +++++ .../CeleryTaskGraph/CeleryTaskBar.tsx | 235 +++++ .../CeleryTaskGraph.style.scss | 122 +++ .../CeleryTaskGraph/CeleryTaskGraph.tsx | 134 +++ .../CeleryTaskGraph/CeleryTaskGraphGrid.tsx | 100 ++ .../CeleryTaskGraph/CeleryTaskGraphUtils.ts | 919 ++++++++++++++++++ .../CeleryTaskLatencyGraph.tsx | 196 ++++ .../CeleryTaskStateGraphConfig.tsx | 57 ++ .../src/components/CeleryTask/CeleryUtils.ts | 92 ++ .../CeleryTask/useCeleryFilterOptions.ts | 32 + frontend/src/constants/query.ts | 1 + frontend/src/constants/routes.ts | 1 + frontend/src/container/AppLayout/index.tsx | 4 +- .../GridCard/WidgetGraphComponent.tsx | 6 + .../GridCardLayout/GridCard/index.tsx | 8 + .../GridCardLayout/GridCard/types.ts | 9 + .../GridTableComponent.styles.scss | 11 + .../container/GridTableComponent/index.tsx | 69 +- .../src/container/GridTableComponent/types.ts | 2 + .../MetricsApplication.factory.ts | 2 + .../src/container/MetricsApplication/types.ts | 1 + .../PanelWrapper/HistogramPanelWrapper.tsx | 4 + .../container/PanelWrapper/PanelWrapper.tsx | 6 + .../PanelWrapper/TablePanelWrapper.tsx | 4 + .../PanelWrapper/UplotPanelWrapper.tsx | 3 + .../PanelWrapper/panelWrapper.types.ts | 4 + frontend/src/container/SideNav/config.ts | 1 + .../TopNav/DateTimeSelectionV2/config.ts | 1 + .../src/lib/uPlotLib/getUplotChartOptions.ts | 30 +- .../uPlotLib/getUplotHistogramChartOptions.ts | 8 + .../src/lib/uPlotLib/utils/generateColor.ts | 1 + .../Celery/CeleryTask/CeleryTask.styles.scss | 44 + .../pages/Celery/CeleryTask/CeleryTask.tsx | 40 + .../MQDetails/MetricPage/MetricPageUtil.ts | 11 +- .../MessagingQueues.styles.scss | 2 +- .../pages/MessagingQueues/MessagingQueues.tsx | 5 - .../MessagingQueuesMainPage.styles.scss | 52 + .../MessagingQueuesMainPage.tsx | 45 + frontend/src/pages/MessagingQueues/index.tsx | 4 +- frontend/src/utils/permission/index.ts | 1 + 46 files changed, 2741 insertions(+), 28 deletions(-) create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskConfigOptions/useGetCeleryFilters.ts create mode 100644 frontend/src/components/CeleryTask/CeleryTaskDetail/CeleryTaskDetail.style.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskDetail/CeleryTaskDetail.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskBar.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraph.style.scss create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraph.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphGrid.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskGraphUtils.ts create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskLatencyGraph.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryTaskGraph/CeleryTaskStateGraphConfig.tsx create mode 100644 frontend/src/components/CeleryTask/CeleryUtils.ts create mode 100644 frontend/src/components/CeleryTask/useCeleryFilterOptions.ts create mode 100644 frontend/src/pages/Celery/CeleryTask/CeleryTask.styles.scss create mode 100644 frontend/src/pages/Celery/CeleryTask/CeleryTask.tsx create mode 100644 frontend/src/pages/MessagingQueues/MessagingQueuesMainPage.styles.scss create mode 100644 frontend/src/pages/MessagingQueues/MessagingQueuesMainPage.tsx diff --git a/frontend/src/AppRoutes/pageComponents.ts b/frontend/src/AppRoutes/pageComponents.ts index 0857ea4664..55edfc54a7 100644 --- a/frontend/src/AppRoutes/pageComponents.ts +++ b/frontend/src/AppRoutes/pageComponents.ts @@ -229,7 +229,7 @@ export const InstalledIntegrations = Loadable( ), ); -export const MessagingQueues = Loadable( +export const MessagingQueuesMainPage = Loadable( () => import(/* webpackChunkName: "MessagingQueues" */ 'pages/MessagingQueues'), ); @@ -247,3 +247,10 @@ export const InfrastructureMonitoring = Loadable( /* webpackChunkName: "InfrastructureMonitoring" */ 'pages/InfrastructureMonitoring' ), ); + +export const CeleryTask = Loadable( + () => + import( + /* webpackChunkName: "CeleryTask" */ 'pages/Celery/CeleryTask/CeleryTask' + ), +); diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.ts index dda546167f..5a259e3968 100644 --- a/frontend/src/AppRoutes/routes.ts +++ b/frontend/src/AppRoutes/routes.ts @@ -1,4 +1,5 @@ import ROUTES from 'constants/routes'; +import MessagingQueues from 'pages/MessagingQueues'; import { RouteProps } from 'react-router-dom'; import { @@ -27,7 +28,6 @@ import { LogsExplorer, LogsIndexToFields, LogsSaveViews, - MessagingQueues, MQDetailPage, MySettings, NewDashboardPage, @@ -401,6 +401,13 @@ const routes: AppRoutes[] = [ key: 'MESSAGING_QUEUES', isPrivate: true, }, + { + path: ROUTES.MESSAGING_QUEUES_CELERY_TASK, + exact: true, + component: MessagingQueues, + key: 'MESSAGING_QUEUES_CELERY_TASK', + isPrivate: true, + }, { path: ROUTES.MESSAGING_QUEUES_DETAIL, exact: true, diff --git a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss new file mode 100644 index 0000000000..1ffd4af3ff --- /dev/null +++ b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.styles.scss @@ -0,0 +1,39 @@ +.celery-task-filters { + display: flex; + justify-content: space-between; + width: 100%; + + .celery-filters { + display: flex; + align-items: center; + gap: 8px; + + .config-select-option { + width: 100%; + .ant-select-selector { + display: flex; + min-height: 32px; + align-items: center; + gap: 16px; + min-width: 164px; + + border-radius: 2px; + border: 1px solid var(--bg-slate-400); + background: var(--bg-ink-300); + } + } + } +} + +.lightMode { + .celery-task-filters { + .celery-filters { + .config-select-option { + .ant-select-selector { + border: 1px solid var(--bg-vanilla-300); + background: var(--bg-vanilla-100); + } + } + } + } +} diff --git a/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx new file mode 100644 index 0000000000..ebb514c40a --- /dev/null +++ b/frontend/src/components/CeleryTask/CeleryTaskConfigOptions/CeleryTaskConfigOptions.tsx @@ -0,0 +1,92 @@ +import './CeleryTaskConfigOptions.styles.scss'; + +import { Color } from '@signozhq/design-tokens'; +import { Button, Select, Spin, Tooltip, Typography } from 'antd'; +import { SelectMaxTagPlaceholder } from 'components/MessagingQueues/MQCommon/MQCommon'; +import { QueryParams } from 'constants/query'; +import useUrlQuery from 'hooks/useUrlQuery'; +import { Check, Share2 } from 'lucide-react'; +import { useState } from 'react'; +import { useHistory, useLocation } from 'react-router-dom'; +import { useCopyToClipboard } from 'react-use'; + +import { + getValuesFromQueryParams, + setQueryParamsFromOptions, +} from '../CeleryUtils'; +import { useCeleryFilterOptions } from '../useCeleryFilterOptions'; + +function CeleryTaskConfigOptions(): JSX.Element { + const { handleSearch, isFetching, options } = useCeleryFilterOptions( + 'celery.task_name', + ); + const history = useHistory(); + const location = useLocation(); + + const [isURLCopied, setIsURLCopied] = useState(false); + const urlQuery = useUrlQuery(); + + const [, handleCopyToClipboard] = useCopyToClipboard(); + + return ( +
+
+ + Task Name + +