Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: sorting logic is updated (#2882)

Palash Guptaef74ef35261c
diff --git a/frontend/src/container/MetricsApplication/TopOperationsTable.tsx b/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
index 540bc0d546..739ef8af0e 100644
--- a/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
+++ b/frontend/src/container/MetricsApplication/TopOperationsTable.tsx
@@ -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)} %`,
},
];
diff --git a/frontend/src/container/MetricsApplication/utils.ts b/frontend/src/container/MetricsApplication/utils.ts
new file mode 100644
index 0000000000..a27242718c
--- /dev/null
+++ b/frontend/src/container/MetricsApplication/utils.ts
@@ -0,0 +1,4 @@
+import { TopOperationList } from './TopOperationsTable';
+
+export const getErrorRate = (list: TopOperationList): number =>
+ (list.errorCount / list.numCalls) * 100;