mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-09-20 18:23:11 +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 { GlobalReducer } from 'types/reducer/globalTime';
|
||||
|
||||
import { getErrorRate } from './utils';
|
||||
|
||||
function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
||||
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
|
||||
(state) => state.globalTime,
|
||||
@ -89,10 +91,10 @@ function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
||||
dataIndex: 'errorCount',
|
||||
key: 'errorCount',
|
||||
width: 50,
|
||||
sorter: (a: TopOperationList, b: TopOperationList): number =>
|
||||
a.errorCount - b.errorCount,
|
||||
render: (value: number, record: TopOperationList): string =>
|
||||
`${((value / record.numCalls) * 100).toFixed(2)} %`,
|
||||
sorter: (first: TopOperationList, second: TopOperationList): number =>
|
||||
getErrorRate(first) - getErrorRate(second),
|
||||
render: (_, record: TopOperationList): string =>
|
||||
`${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