mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 11:28:59 +08:00
feat(FE: Span): add span kind filter (#219)
* Added span kind filter * changed state to const * Removed unnecessary console * Fixed undefined issue, changed a bit in the spanKind type * set default value for parameter passed in handleChangeSpanKind func
This commit is contained in:
parent
f070bdf5b9
commit
48e32878e6
@ -3,13 +3,6 @@
|
|||||||
.ant-space-item {
|
.ant-space-item {
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
.instrument-card{
|
|
||||||
border-radius: 4px;
|
|
||||||
background: #313131;
|
|
||||||
padding: 33px 23px;
|
|
||||||
max-width: 800px;
|
|
||||||
margin-top: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#chart svg{
|
#chart svg{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -5,4 +5,5 @@ export enum METRICS_PAGE_QUERY_PARAM {
|
|||||||
service = "service",
|
service = "service",
|
||||||
error = "error",
|
error = "error",
|
||||||
operation = "operation",
|
operation = "operation",
|
||||||
|
kind = "kind"
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,9 @@ const _TraceCustomVisualizations = (props: TraceCustomVisualizationsProps) => {
|
|||||||
"&maxDuration=" +
|
"&maxDuration=" +
|
||||||
props.traceFilters.latency?.max +
|
props.traceFilters.latency?.max +
|
||||||
"&minDuration=" +
|
"&minDuration=" +
|
||||||
props.traceFilters.latency?.min;
|
props.traceFilters.latency?.min +
|
||||||
|
"&kind=" +
|
||||||
|
props.traceFilters.kind;
|
||||||
if (props.traceFilters.tags)
|
if (props.traceFilters.tags)
|
||||||
request_string =
|
request_string =
|
||||||
request_string +
|
request_string +
|
||||||
|
@ -40,6 +40,11 @@ interface TagKeyOptionItem {
|
|||||||
tagCount: number;
|
tagCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ISpanKind {
|
||||||
|
label: "SERVER" | "CLIENT";
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
const _TraceFilter = (props: TraceFilterProps) => {
|
const _TraceFilter = (props: TraceFilterProps) => {
|
||||||
const [serviceList, setServiceList] = useState<string[]>([]);
|
const [serviceList, setServiceList] = useState<string[]>([]);
|
||||||
const [operationList, setOperationsList] = useState<string[]>([]);
|
const [operationList, setOperationsList] = useState<string[]>([]);
|
||||||
@ -48,12 +53,24 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
const urlParams = new URLSearchParams(location.search.split("?")[1]);
|
const urlParams = new URLSearchParams(location.search.split("?")[1]);
|
||||||
const { state } = useRoute();
|
const { state } = useRoute();
|
||||||
|
|
||||||
|
const spanKindList: ISpanKind[] = [
|
||||||
|
{
|
||||||
|
label: "SERVER",
|
||||||
|
value: "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "CLIENT",
|
||||||
|
value: "3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleApplyFilterForm({
|
handleApplyFilterForm({
|
||||||
service: "",
|
service: "",
|
||||||
tags: [],
|
tags: [],
|
||||||
operation: "",
|
operation: "",
|
||||||
latency: { min: "", max: "" },
|
latency: { min: "", max: "" },
|
||||||
|
kind: ""
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -76,6 +93,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
...props.traceFilters,
|
...props.traceFilters,
|
||||||
operation: operationName,
|
operation: operationName,
|
||||||
service: serviceName,
|
service: serviceName,
|
||||||
|
kind: ""
|
||||||
});
|
});
|
||||||
populateData(serviceName);
|
populateData(serviceName);
|
||||||
} else if (serviceName && errorTag) {
|
} else if (serviceName && errorTag) {
|
||||||
@ -89,6 +107,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
operator: "equals",
|
operator: "equals",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
kind: ""
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (operationName) {
|
if (operationName) {
|
||||||
@ -117,7 +136,9 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
"&maxDuration=" +
|
"&maxDuration=" +
|
||||||
props.traceFilters.latency?.max +
|
props.traceFilters.latency?.max +
|
||||||
"&minDuration=" +
|
"&minDuration=" +
|
||||||
props.traceFilters.latency?.min;
|
props.traceFilters.latency?.min +
|
||||||
|
"&kind=" +
|
||||||
|
props.traceFilters.kind;
|
||||||
if (props.traceFilters.tags)
|
if (props.traceFilters.tags)
|
||||||
request_string =
|
request_string =
|
||||||
request_string +
|
request_string +
|
||||||
@ -173,6 +194,10 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
form_basefilter.setFieldsValue({ operation: props.traceFilters.operation });
|
form_basefilter.setFieldsValue({ operation: props.traceFilters.operation });
|
||||||
}, [props.traceFilters.operation]);
|
}, [props.traceFilters.operation]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
form_basefilter.setFieldsValue({ kind: props.traceFilters.kind });
|
||||||
|
}, [props.traceFilters.kind]);
|
||||||
|
|
||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [modalVisible, setModalVisible] = useState(false);
|
||||||
const [loading] = useState(false);
|
const [loading] = useState(false);
|
||||||
|
|
||||||
@ -257,6 +282,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
operator: values.operator,
|
operator: values.operator,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
kind: props.traceFilters.kind
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
props.updateTraceFilters({
|
props.updateTraceFilters({
|
||||||
@ -270,6 +296,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
operator: values.operator,
|
operator: values.operator,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
kind: props.traceFilters.kind
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +361,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
max: "",
|
max: "",
|
||||||
min: "",
|
min: "",
|
||||||
},
|
},
|
||||||
|
kind: values.kind
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -344,10 +372,15 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
operation: "",
|
operation: "",
|
||||||
tags: [],
|
tags: [],
|
||||||
latency: { min: "", max: "" },
|
latency: { min: "", max: "" },
|
||||||
|
kind: ""
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleChangeSpanKind = (value:string = '') => {
|
||||||
|
props.updateTraceFilters({ ...props.traceFilters, kind: value });
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>Filter Traces</div>
|
<div>Filter Traces</div>
|
||||||
@ -396,6 +429,20 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
|||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem name="spanKind">
|
||||||
|
<Select
|
||||||
|
showSearch
|
||||||
|
style={{ width: 180 }}
|
||||||
|
onChange={handleChangeSpanKind}
|
||||||
|
placeholder="Select Span Kind"
|
||||||
|
allowClear
|
||||||
|
>
|
||||||
|
{spanKindList.map(spanKind => (
|
||||||
|
<Option value={spanKind.value} key={spanKind.value}>{spanKind.label}</Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
{/* <FormItem>
|
{/* <FormItem>
|
||||||
<Button type="primary" htmlType="submit">Apply Filters</Button>
|
<Button type="primary" htmlType="submit">Apply Filters</Button>
|
||||||
</FormItem> */}
|
</FormItem> */}
|
||||||
|
@ -17,6 +17,7 @@ export interface TraceFilters {
|
|||||||
service?: string;
|
service?: string;
|
||||||
latency?: LatencyValue;
|
latency?: LatencyValue;
|
||||||
operation?: string;
|
operation?: string;
|
||||||
|
kind?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//define interface for action. Action creator always returns object of this type
|
//define interface for action. Action creator always returns object of this type
|
||||||
|
@ -9,6 +9,7 @@ const initialState: TraceFilters = {
|
|||||||
tags: [],
|
tags: [],
|
||||||
operation: "",
|
operation: "",
|
||||||
latency: { min: "", max: "" },
|
latency: { min: "", max: "" },
|
||||||
|
kind: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
const TraceFilterReducer = (state = initialState, action: ACTION) => {
|
const TraceFilterReducer = (state = initialState, action: ACTION) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user