mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-09-20 21:13:13 +08:00
fix: sorting logic is updated (#2882)
* fix: sorting logic is updated * fix: made a util for error rate * chore: updated the function name
This commit is contained in:
parent
bd6745dd66
commit
ef74ef3526
@ -11,6 +11,8 @@ import { useParams } from 'react-router-dom';
|
|||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
|
|
||||||
|
import { getErrorRate } from './utils';
|
||||||
|
|
||||||
function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
||||||
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
|
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
|
||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
@ -89,10 +91,10 @@ function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
|||||||
dataIndex: 'errorCount',
|
dataIndex: 'errorCount',
|
||||||
key: 'errorCount',
|
key: 'errorCount',
|
||||||
width: 50,
|
width: 50,
|
||||||
sorter: (a: TopOperationList, b: TopOperationList): number =>
|
sorter: (first: TopOperationList, second: TopOperationList): number =>
|
||||||
a.errorCount - b.errorCount,
|
getErrorRate(first) - getErrorRate(second),
|
||||||
render: (value: number, record: TopOperationList): string =>
|
render: (_, record: TopOperationList): string =>
|
||||||
`${((value / record.numCalls) * 100).toFixed(2)} %`,
|
`${getErrorRate(record).toFixed(2)} %`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
4
frontend/src/container/MetricsApplication/utils.ts
Normal file
4
frontend/src/container/MetricsApplication/utils.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { TopOperationList } from './TopOperationsTable';
|
||||||
|
|
||||||
|
export const getErrorRate = (list: TopOperationList): number =>
|
||||||
|
(list.errorCount / list.numCalls) * 100;
|
Loading…
x
Reference in New Issue
Block a user