mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-14 18:11:32 +08:00

* feat: dashboard widget page is refactored * chore: key is updated * chore: delete widget is updated * chore: naming of the file is updated * feat: dashboard changes are updated and selected dashboard and dashboardId is added * chore: dashboard widget page is updated * feat: setlayout is updated * chore: selected dashboard is updated * chore: dashboard is updated * fix: feedback is updated * chore: comments are resolved * chore: empty widget id is updated * fix: variables is updated * chore: dashboard variable and name,description is now updated in hooks * chore: build is fixed * chore: loading experience is updated * chore: title is updated * fix: dashboard variables and other changes are updated * feat: dashboard reducer is removed * feat: widget header is updated * feat: widget header is updated * chore: dashboard is updated * chore: feedback is updated * fix: issues are fixed * chore: delete is updated * chore: warning message is updated * chore: warning message is updated * chore: widget graph component * feat: dashboard condition is updated * chore: getChartData is updated * chore: widget details page is updated * feat: tab sync is updated * chore: layout is updated * chore: labels is updated * chore: message is updated * chore: warining message is updated --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
121 lines
3.0 KiB
TypeScript
121 lines
3.0 KiB
TypeScript
import { Tooltip, Typography } from 'antd';
|
|
import { ColumnsType } from 'antd/lib/table';
|
|
import { ResizeTable } from 'components/ResizeTable';
|
|
import useResourceAttribute from 'hooks/useResourceAttribute';
|
|
import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils';
|
|
import { useSelector } from 'react-redux';
|
|
import { useParams } from 'react-router-dom';
|
|
import { AppState } from 'store/reducers';
|
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
|
|
|
import { getErrorRate, navigateToTrace } from './utils';
|
|
|
|
function TopOperationsTable({ data }: TopOperationsTableProps): JSX.Element {
|
|
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
|
|
(state) => state.globalTime,
|
|
);
|
|
const { queries } = useResourceAttribute();
|
|
|
|
const selectedTraceTags: string = JSON.stringify(
|
|
convertRawQueriesToTraceSelectedTags(queries) || [],
|
|
);
|
|
|
|
const params = useParams<{ servicename: string }>();
|
|
|
|
const handleOnClick = (operation: string): void => {
|
|
const { servicename } = params;
|
|
|
|
navigateToTrace({
|
|
servicename,
|
|
operation,
|
|
minTime,
|
|
maxTime,
|
|
selectedTraceTags,
|
|
});
|
|
};
|
|
|
|
const columns: ColumnsType<TopOperationList> = [
|
|
{
|
|
title: 'Name',
|
|
dataIndex: 'name',
|
|
key: 'name',
|
|
width: 100,
|
|
render: (text: string): JSX.Element => (
|
|
<Tooltip placement="topLeft" title={text}>
|
|
<Typography.Link onClick={(): void => handleOnClick(text)}>
|
|
{text}
|
|
</Typography.Link>
|
|
</Tooltip>
|
|
),
|
|
},
|
|
{
|
|
title: 'P50 (in ms)',
|
|
dataIndex: 'p50',
|
|
key: 'p50',
|
|
width: 50,
|
|
sorter: (a: TopOperationList, b: TopOperationList): number => a.p50 - b.p50,
|
|
render: (value: number): string => (value / 1000000).toFixed(2),
|
|
},
|
|
{
|
|
title: 'P95 (in ms)',
|
|
dataIndex: 'p95',
|
|
key: 'p95',
|
|
width: 50,
|
|
sorter: (a: TopOperationList, b: TopOperationList): number => a.p95 - b.p95,
|
|
render: (value: number): string => (value / 1000000).toFixed(2),
|
|
},
|
|
{
|
|
title: 'P99 (in ms)',
|
|
dataIndex: 'p99',
|
|
key: 'p99',
|
|
width: 50,
|
|
sorter: (a: TopOperationList, b: TopOperationList): number => a.p99 - b.p99,
|
|
render: (value: number): string => (value / 1000000).toFixed(2),
|
|
},
|
|
{
|
|
title: 'Number of Calls',
|
|
dataIndex: 'numCalls',
|
|
key: 'numCalls',
|
|
width: 50,
|
|
sorter: (a: TopOperationList, b: TopOperationList): number =>
|
|
a.numCalls - b.numCalls,
|
|
},
|
|
{
|
|
title: 'Error Rate',
|
|
dataIndex: 'errorCount',
|
|
key: 'errorCount',
|
|
width: 50,
|
|
sorter: (first: TopOperationList, second: TopOperationList): number =>
|
|
getErrorRate(first) - getErrorRate(second),
|
|
render: (_, record: TopOperationList): string =>
|
|
`${getErrorRate(record).toFixed(2)} %`,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<ResizeTable
|
|
columns={columns}
|
|
showHeader
|
|
title={(): string => 'Key Operations'}
|
|
tableLayout="fixed"
|
|
dataSource={data}
|
|
rowKey="name"
|
|
/>
|
|
);
|
|
}
|
|
|
|
export interface TopOperationList {
|
|
p50: number;
|
|
p95: number;
|
|
p99: number;
|
|
numCalls: number;
|
|
name: string;
|
|
errorCount: number;
|
|
}
|
|
|
|
interface TopOperationsTableProps {
|
|
data: TopOperationList[];
|
|
}
|
|
|
|
export default TopOperationsTable;
|