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.

feat: total count is generated from the filter (#1047)

palash-signoz90637212bc06
diff --git a/frontend/src/container/Trace/TraceTable/index.tsx b/frontend/src/container/Trace/TraceTable/index.tsx
index b7ec79b6e5..165743071c 100644
--- a/frontend/src/container/Trace/TraceTable/index.tsx
+++ b/frontend/src/container/Trace/TraceTable/index.tsx
@@ -4,6 +4,7 @@ import ROUTES from 'constants/routes';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import history from 'lib/history';
+import omit from 'lodash-es/omit';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Dispatch } from 'redux';
@@ -29,11 +30,15 @@ function TraceTable(): JSX.Element {
userSelectedFilter,
isFilterExclude,
filterToFetchData,
+ filter,
} = useSelector<AppState, TraceReducer>((state) => state.traces);
+ const statusFilter = filter.get('status');
+ const selectedStatusFilter = selectedFilter.get('status');
+
const dispatch = useDispatch<Dispatch<AppActions>>();
- const { loading, total, order: spansAggregateOrder } = spansAggregate;
+ const { loading, order: spansAggregateOrder } = spansAggregate;
type TableType = FlatArray<TraceReducer['spansAggregate']['data'], 1>;
@@ -171,6 +176,12 @@ function TraceTable(): JSX.Element {
}
};
+ const totalObject = omit(statusFilter, [...(selectedStatusFilter || [])]);
+ const totalCount = Object.values(totalObject).reduce(
+ (a, b) => parseInt(String(a), 10) + parseInt(String(b), 10),
+ 0,
+ ) as number;
+
return (
<Table
onChange={onChangeHandler}
@@ -193,7 +204,7 @@ function TraceTable(): JSX.Element {
pageSize: spansAggregate.pageSize,
responsive: true,
position: ['bottomLeft'],
- total,
+ total: totalCount,
}}
/>
);
diff --git a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts
index 1641ebe8f2..47d55bd218 100644
--- a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts
+++ b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts
@@ -8,7 +8,7 @@ export const parseQueryIntoOrder = (
): ParsedUrl<TraceReducer['spansAggregate']['order']> => {
const url = new URLSearchParams(query);
- let current = 'ascend';
+ let current = '';
const selected = url.get('spanAggregateOrder');
diff --git a/frontend/src/store/reducers/trace.ts b/frontend/src/store/reducers/trace.ts
index 793bf94889..b99ee7dd3a 100644
--- a/frontend/src/store/reducers/trace.ts
+++ b/frontend/src/store/reducers/trace.ts
@@ -41,7 +41,7 @@ const initialValue: TraceReducer = {
error: false,
total: 0,
pageSize: 10,
- order: 'ascend',
+ order: '',
orderParam: '',
},
selectedGroupBy: '',