mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-10 22:18:59 +08:00
feat: soring filter is added
This commit is contained in:
parent
05371085f9
commit
6ab7fea8de
@ -15,6 +15,7 @@ const getSpanAggregate = async (
|
|||||||
end: String(props.end),
|
end: String(props.end),
|
||||||
limit: props.limit,
|
limit: props.limit,
|
||||||
offset: props.offset,
|
offset: props.offset,
|
||||||
|
order: props.order,
|
||||||
};
|
};
|
||||||
|
|
||||||
const exclude: TraceFilterEnum[] = [];
|
const exclude: TraceFilterEnum[] = [];
|
||||||
|
@ -1,26 +1,24 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
import Table, { ColumnsType } from 'antd/lib/table';
|
|
||||||
import { TableProps, Tag } from 'antd';
|
import { TableProps, Tag } from 'antd';
|
||||||
|
import Table, { ColumnsType } from 'antd/lib/table';
|
||||||
|
import ROUTES from 'constants/routes';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import duration from 'dayjs/plugin/duration';
|
||||||
|
import history from 'lib/history';
|
||||||
|
import React from 'react';
|
||||||
import { connect, useSelector } from 'react-redux';
|
import { connect, useSelector } from 'react-redux';
|
||||||
import { AppState } from 'store/reducers';
|
|
||||||
import { TraceReducer } from 'types/reducer/trace';
|
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import { ThunkDispatch } from 'redux-thunk';
|
||||||
import AppActions from 'types/actions';
|
|
||||||
import {
|
import {
|
||||||
GetSpansAggregate,
|
GetSpansAggregate,
|
||||||
GetSpansAggregateProps,
|
GetSpansAggregateProps,
|
||||||
} from 'store/actions/trace/getInitialSpansAggregate';
|
} from 'store/actions/trace/getInitialSpansAggregate';
|
||||||
|
import { AppState } from 'store/reducers';
|
||||||
|
import AppActions from 'types/actions';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
import dayjs from 'dayjs';
|
import { TraceReducer } from 'types/reducer/trace';
|
||||||
import duration from 'dayjs/plugin/duration';
|
|
||||||
import history from 'lib/history';
|
|
||||||
import ROUTES from 'constants/routes';
|
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
const TraceTable = ({ getSpansAggregate }: TraceProps): JSX.Element => {
|
||||||
const {
|
const {
|
||||||
spansAggregate,
|
spansAggregate,
|
||||||
selectedFilter,
|
selectedFilter,
|
||||||
@ -41,19 +39,16 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
title: 'Date',
|
title: 'Date',
|
||||||
dataIndex: 'timestamp',
|
dataIndex: 'timestamp',
|
||||||
key: 'timestamp',
|
key: 'timestamp',
|
||||||
render: (value: TableType['timestamp']) => {
|
sorter: true,
|
||||||
|
render: (value: TableType['timestamp']): JSX.Element => {
|
||||||
const day = dayjs(value);
|
const day = dayjs(value);
|
||||||
return <div>{day.format('DD/MM/YYYY hh:mm:ss A')}</div>;
|
return <div>{day.format('DD/MM/YYYY hh:mm:ss A')}</div>;
|
||||||
},
|
},
|
||||||
sorter: (a, b) =>
|
|
||||||
dayjs(a.timestamp).toDate().getTime() -
|
|
||||||
dayjs(b.timestamp).toDate().getTime(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Service',
|
title: 'Service',
|
||||||
dataIndex: 'serviceName',
|
dataIndex: 'serviceName',
|
||||||
key: 'serviceName',
|
key: 'serviceName',
|
||||||
sorter: (a, b) => a.serviceName.length - b.serviceName.length,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Operation',
|
title: 'Operation',
|
||||||
@ -64,22 +59,19 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
title: 'Duration',
|
title: 'Duration',
|
||||||
dataIndex: 'durationNano',
|
dataIndex: 'durationNano',
|
||||||
key: 'durationNano',
|
key: 'durationNano',
|
||||||
sorter: (a, b) => a.durationNano - b.durationNano,
|
render: (value: TableType['durationNano']): JSX.Element => (
|
||||||
render: (value: TableType['durationNano']) => {
|
<div>
|
||||||
return (
|
{`${dayjs
|
||||||
<div>
|
.duration({ milliseconds: value / 1000000 })
|
||||||
{`${dayjs
|
.asMilliseconds()} ms`}
|
||||||
.duration({ milliseconds: value / 1000000 })
|
</div>
|
||||||
.asMilliseconds()} ms`}
|
),
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Method',
|
title: 'Method',
|
||||||
dataIndex: 'httpMethod',
|
dataIndex: 'httpMethod',
|
||||||
key: 'httpMethod',
|
key: 'httpMethod',
|
||||||
render: (value: TableType['httpMethod']) => {
|
render: (value: TableType['httpMethod']): JSX.Element => {
|
||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
return <div>-</div>;
|
return <div>-</div>;
|
||||||
}
|
}
|
||||||
@ -90,8 +82,7 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
title: 'Status Code',
|
title: 'Status Code',
|
||||||
dataIndex: 'httpCode',
|
dataIndex: 'httpCode',
|
||||||
key: 'httpCode',
|
key: 'httpCode',
|
||||||
sorter: (a, b) => a.httpCode.length - b.httpCode.length,
|
render: (value: TableType['httpCode']): JSX.Element => {
|
||||||
render: (value: TableType['httpCode']) => {
|
|
||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
return <div>-</div>;
|
return <div>-</div>;
|
||||||
}
|
}
|
||||||
@ -100,7 +91,13 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const onChangeHandler: TableProps<TableType>['onChange'] = (props) => {
|
const onChangeHandler: TableProps<TableType>['onChange'] = (
|
||||||
|
props,
|
||||||
|
_,
|
||||||
|
sort,
|
||||||
|
) => {
|
||||||
|
const { order = 'ascend' } = sort;
|
||||||
|
|
||||||
if (props.current && props.pageSize) {
|
if (props.current && props.pageSize) {
|
||||||
getSpansAggregate({
|
getSpansAggregate({
|
||||||
maxTime: globalTime.maxTime,
|
maxTime: globalTime.maxTime,
|
||||||
@ -109,6 +106,7 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
current: props.current,
|
current: props.current,
|
||||||
pageSize: props.pageSize,
|
pageSize: props.pageSize,
|
||||||
selectedTags,
|
selectedTags,
|
||||||
|
order: order === 'ascend' ? 'ascending' : 'descending',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -120,7 +118,7 @@ const TraceTable = ({ getSpansAggregate }: TraceProps) => {
|
|||||||
loading={loading || filterLoading}
|
loading={loading || filterLoading}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
onRow={(record) => ({
|
onRow={(record) => ({
|
||||||
onClick: () => {
|
onClick: (): void => {
|
||||||
history.push({
|
history.push({
|
||||||
pathname: ROUTES.TRACE + '/' + record.traceID,
|
pathname: ROUTES.TRACE + '/' + record.traceID,
|
||||||
state: {
|
state: {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
import { notification } from 'antd';
|
||||||
|
import getSpansAggregate from 'api/trace/getSpansAggregate';
|
||||||
import { Dispatch, Store } from 'redux';
|
import { Dispatch, Store } from 'redux';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import AppActions from 'types/actions';
|
import AppActions from 'types/actions';
|
||||||
import { UPDATE_SPANS_AGGREEGATE } from 'types/actions/trace';
|
import { UPDATE_SPANS_AGGREEGATE } from 'types/actions/trace';
|
||||||
import getSpansAggregate from 'api/trace/getSpansAggregate';
|
import { Props as GetSpanAggregateProps } from 'types/api/trace/getSpanAggregate';
|
||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
import { TraceReducer } from 'types/reducer/trace';
|
import { TraceReducer } from 'types/reducer/trace';
|
||||||
import { notification } from 'antd';
|
|
||||||
|
|
||||||
export const GetSpansAggregate = (
|
export const GetSpansAggregate = (
|
||||||
props: GetSpansAggregateProps,
|
props: GetSpansAggregateProps,
|
||||||
@ -52,6 +53,7 @@ export const GetSpansAggregate = (
|
|||||||
offset: props.current * props.pageSize - props.pageSize,
|
offset: props.current * props.pageSize - props.pageSize,
|
||||||
selectedTags: props.selectedTags,
|
selectedTags: props.selectedTags,
|
||||||
isFilterExclude: traces.isFilterExclude,
|
isFilterExclude: traces.isFilterExclude,
|
||||||
|
order: props.order,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
@ -112,4 +114,5 @@ export interface GetSpansAggregateProps {
|
|||||||
current: TraceReducer['spansAggregate']['currentPage'];
|
current: TraceReducer['spansAggregate']['currentPage'];
|
||||||
pageSize: TraceReducer['spansAggregate']['pageSize'];
|
pageSize: TraceReducer['spansAggregate']['pageSize'];
|
||||||
selectedTags: TraceReducer['selectedTags'];
|
selectedTags: TraceReducer['selectedTags'];
|
||||||
|
order: GetSpanAggregateProps['order'];
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ export interface Props {
|
|||||||
limit: number;
|
limit: number;
|
||||||
offset: number;
|
offset: number;
|
||||||
selectedTags: TraceReducer['selectedTags'];
|
selectedTags: TraceReducer['selectedTags'];
|
||||||
|
order?: 'descending' | 'ascending';
|
||||||
isFilterExclude: TraceReducer['isFilterExclude'];
|
isFilterExclude: TraceReducer['isFilterExclude'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user