mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 21:15:53 +08:00
chore: added logeEvents in Kafka-ui (#5810)
* chore: added logeEvents in Kafka-ui * chore: changed event logic for graph data fetch
This commit is contained in:
parent
363fb7bc34
commit
5dc5b2e366
@ -34,6 +34,7 @@ function GridCardGraph({
|
|||||||
onClickHandler,
|
onClickHandler,
|
||||||
onDragSelect,
|
onDragSelect,
|
||||||
customTooltipElement,
|
customTooltipElement,
|
||||||
|
dataAvailable,
|
||||||
}: GridCardGraphProps): JSX.Element {
|
}: GridCardGraphProps): JSX.Element {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [errorMessage, setErrorMessage] = useState<string>();
|
const [errorMessage, setErrorMessage] = useState<string>();
|
||||||
@ -180,6 +181,9 @@ function GridCardGraph({
|
|||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
setErrorMessage(error.message);
|
setErrorMessage(error.message);
|
||||||
},
|
},
|
||||||
|
onSettled: (data) => {
|
||||||
|
dataAvailable?.(Boolean(data?.payload?.data?.result?.length));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ export interface GridCardGraphProps {
|
|||||||
version?: string;
|
version?: string;
|
||||||
onDragSelect: (start: number, end: number) => void;
|
onDragSelect: (start: number, end: number) => void;
|
||||||
customTooltipElement?: HTMLDivElement;
|
customTooltipElement?: HTMLDivElement;
|
||||||
|
dataAvailable?: (isDataAvailable: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetGraphVisibilityStateOnLegendClickProps {
|
export interface GetGraphVisibilityStateOnLegendClickProps {
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import '../MessagingQueues.styles.scss';
|
import '../MessagingQueues.styles.scss';
|
||||||
|
|
||||||
import { Select, Typography } from 'antd';
|
import { Select, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
|
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
|
||||||
import { ListMinus } from 'lucide-react';
|
import { ListMinus } from 'lucide-react';
|
||||||
|
import { useEffect } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { MessagingQueuesViewType } from '../MessagingQueuesUtils';
|
import { MessagingQueuesViewType } from '../MessagingQueuesUtils';
|
||||||
@ -15,6 +17,10 @@ import MessagingQueuesGraph from '../MQGraph/MQGraph';
|
|||||||
function MQDetailPage(): JSX.Element {
|
function MQDetailPage(): JSX.Element {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
logEvent('Messaging Queues: Detail page visited', {});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="messaging-queue-container">
|
<div className="messaging-queue-container">
|
||||||
<div className="messaging-breadcrumb">
|
<div className="messaging-breadcrumb">
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import './MQTables.styles.scss';
|
import './MQTables.styles.scss';
|
||||||
|
|
||||||
import { Skeleton, Table, Typography } from 'antd';
|
import { Skeleton, Table, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { isNumber } from 'chart.js/helpers';
|
import { isNumber } from 'chart.js/helpers';
|
||||||
import { ColumnTypeRender } from 'components/Logs/TableView/types';
|
import { ColumnTypeRender } from 'components/Logs/TableView/types';
|
||||||
@ -17,7 +18,7 @@ import {
|
|||||||
RowData,
|
RowData,
|
||||||
SelectedTimelineQuery,
|
SelectedTimelineQuery,
|
||||||
} from 'pages/MessagingQueues/MessagingQueuesUtils';
|
} from 'pages/MessagingQueues/MessagingQueuesUtils';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useMutation } from 'react-query';
|
import { useMutation } from 'react-query';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
@ -169,11 +170,28 @@ function MessagingQueuesTable({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
useEffect(() => getConsumerDetails(props), [currentTab, props]);
|
useEffect(() => getConsumerDetails(props), [currentTab, props]);
|
||||||
|
|
||||||
const isEmptyDetails = (timelineQueryData: SelectedTimelineQuery): boolean =>
|
const isLogEventCalled = useRef<boolean>(false);
|
||||||
isEmpty(timelineQueryData) ||
|
|
||||||
(!timelineQueryData?.group &&
|
const isEmptyDetails = (timelineQueryData: SelectedTimelineQuery): boolean => {
|
||||||
!timelineQueryData?.topic &&
|
const isEmptyDetail =
|
||||||
!timelineQueryData?.partition);
|
isEmpty(timelineQueryData) ||
|
||||||
|
(!timelineQueryData?.group &&
|
||||||
|
!timelineQueryData?.topic &&
|
||||||
|
!timelineQueryData?.partition);
|
||||||
|
|
||||||
|
if (!isEmptyDetail && !isLogEventCalled.current) {
|
||||||
|
logEvent('Messaging Queues: More details viewed', {
|
||||||
|
'tab-option': ConsumerLagDetailTitle[currentTab],
|
||||||
|
variables: {
|
||||||
|
group: timelineQueryData?.group,
|
||||||
|
topic: timelineQueryData?.topic,
|
||||||
|
partition: timelineQueryData?.partition,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
isLogEventCalled.current = true;
|
||||||
|
}
|
||||||
|
return isEmptyDetail;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mq-tables-container">
|
<div className="mq-tables-container">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import { ViewMenuAction } from 'container/GridCardLayout/config';
|
import { ViewMenuAction } from 'container/GridCardLayout/config';
|
||||||
@ -6,7 +7,7 @@ import { Card } from 'container/GridCardLayout/styles';
|
|||||||
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
import useUrlQuery from 'hooks/useUrlQuery';
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo, useRef } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { useHistory, useLocation } from 'react-router-dom';
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
import { UpdateTimeInterval } from 'store/actions';
|
import { UpdateTimeInterval } from 'store/actions';
|
||||||
@ -34,8 +35,10 @@ function MessagingQueuesGraph(): JSX.Element {
|
|||||||
() => getWidgetQueryBuilder(getWidgetQuery({ filterItems })),
|
() => getWidgetQueryBuilder(getWidgetQuery({ filterItems })),
|
||||||
[filterItems],
|
[filterItems],
|
||||||
);
|
);
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const isLogEventCalled = useRef<boolean>(false);
|
||||||
|
|
||||||
const messagingQueueCustomTooltipText = (): HTMLDivElement => {
|
const messagingQueueCustomTooltipText = (): HTMLDivElement => {
|
||||||
const customText = document.createElement('div');
|
const customText = document.createElement('div');
|
||||||
@ -66,6 +69,14 @@ function MessagingQueuesGraph(): JSX.Element {
|
|||||||
[dispatch, history, pathname, urlQuery],
|
[dispatch, history, pathname, urlQuery],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const checkIfDataExists = (isDataAvailable: boolean): void => {
|
||||||
|
if (!isLogEventCalled.current) {
|
||||||
|
isLogEventCalled.current = true;
|
||||||
|
logEvent('Messaging Queues: Graph data fetched', {
|
||||||
|
isDataAvailable,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
isDarkMode={isDarkMode}
|
isDarkMode={isDarkMode}
|
||||||
@ -80,6 +91,7 @@ function MessagingQueuesGraph(): JSX.Element {
|
|||||||
}}
|
}}
|
||||||
onDragSelect={onDragSelect}
|
onDragSelect={onDragSelect}
|
||||||
customTooltipElement={messagingQueueCustomTooltipText()}
|
customTooltipElement={messagingQueueCustomTooltipText()}
|
||||||
|
dataAvailable={checkIfDataExists}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
@ -3,9 +3,11 @@ import './MessagingQueues.styles.scss';
|
|||||||
import { ExclamationCircleFilled } from '@ant-design/icons';
|
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import { Button, Modal } from 'antd';
|
import { Button, Modal } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
|
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
|
||||||
import { Calendar, ListMinus } from 'lucide-react';
|
import { Calendar, ListMinus } from 'lucide-react';
|
||||||
|
import { useEffect } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { isCloudUser } from 'utils/app';
|
import { isCloudUser } from 'utils/app';
|
||||||
|
|
||||||
@ -21,12 +23,20 @@ function MessagingQueues(): JSX.Element {
|
|||||||
const { confirm } = Modal;
|
const { confirm } = Modal;
|
||||||
|
|
||||||
const showConfirm = (): void => {
|
const showConfirm = (): void => {
|
||||||
|
logEvent('Messaging Queues: View details clicked', {
|
||||||
|
page: 'Messaging Queues Overview',
|
||||||
|
source: 'Consumer Latency view',
|
||||||
|
});
|
||||||
|
|
||||||
confirm({
|
confirm({
|
||||||
icon: <ExclamationCircleFilled />,
|
icon: <ExclamationCircleFilled />,
|
||||||
content:
|
content:
|
||||||
'Before navigating to the details page, please make sure you have configured all the required setup to ensure correct data monitoring.',
|
'Before navigating to the details page, please make sure you have configured all the required setup to ensure correct data monitoring.',
|
||||||
className: 'overview-confirm-modal',
|
className: 'overview-confirm-modal',
|
||||||
onOk() {
|
onOk() {
|
||||||
|
logEvent('Messaging Queues: Proceed button clicked', {
|
||||||
|
page: 'Messaging Queues Overview',
|
||||||
|
});
|
||||||
history.push(ROUTES.MESSAGING_QUEUES_DETAIL);
|
history.push(ROUTES.MESSAGING_QUEUES_DETAIL);
|
||||||
},
|
},
|
||||||
okText: 'Proceed',
|
okText: 'Proceed',
|
||||||
@ -35,7 +45,11 @@ function MessagingQueues(): JSX.Element {
|
|||||||
|
|
||||||
const isCloudUserVal = isCloudUser();
|
const isCloudUserVal = isCloudUser();
|
||||||
|
|
||||||
const getStartedRedirect = (link: string): void => {
|
const getStartedRedirect = (link: string, sourceCard: string): void => {
|
||||||
|
logEvent('Messaging Queues: Get started clicked', {
|
||||||
|
source: sourceCard,
|
||||||
|
link: isCloudUserVal ? link : KAFKA_SETUP_DOC_LINK,
|
||||||
|
});
|
||||||
if (isCloudUserVal) {
|
if (isCloudUserVal) {
|
||||||
history.push(link);
|
history.push(link);
|
||||||
} else {
|
} else {
|
||||||
@ -43,6 +57,10 @@ function MessagingQueues(): JSX.Element {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
logEvent('Messaging Queues: Overview page visited', {});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="messaging-queue-container">
|
<div className="messaging-queue-container">
|
||||||
<div className="messaging-breadcrumb">
|
<div className="messaging-breadcrumb">
|
||||||
@ -70,7 +88,10 @@ function MessagingQueues(): JSX.Element {
|
|||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
onClick={(): void =>
|
onClick={(): void =>
|
||||||
getStartedRedirect(ROUTES.GET_STARTED_APPLICATION_MONITORING)
|
getStartedRedirect(
|
||||||
|
ROUTES.GET_STARTED_APPLICATION_MONITORING,
|
||||||
|
'Configure Consumer',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
@ -88,7 +109,10 @@ function MessagingQueues(): JSX.Element {
|
|||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
onClick={(): void =>
|
onClick={(): void =>
|
||||||
getStartedRedirect(ROUTES.GET_STARTED_APPLICATION_MONITORING)
|
getStartedRedirect(
|
||||||
|
ROUTES.GET_STARTED_APPLICATION_MONITORING,
|
||||||
|
'Configure Producer',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
@ -106,7 +130,10 @@ function MessagingQueues(): JSX.Element {
|
|||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
onClick={(): void =>
|
onClick={(): void =>
|
||||||
getStartedRedirect(ROUTES.GET_STARTED_INFRASTRUCTURE_MONITORING)
|
getStartedRedirect(
|
||||||
|
ROUTES.GET_STARTED_INFRASTRUCTURE_MONITORING,
|
||||||
|
'Monitor kafka',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
|
Loading…
x
Reference in New Issue
Block a user