mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
Add support for service from metrics to trace page
This commit is contained in:
parent
08ba714637
commit
1ebfa0679e
@ -31,24 +31,29 @@ interface ServicesMetricsProps extends RouteComponentProps<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
||||||
const params = useParams<{ servicename?: string }>();
|
const {servicename} = useParams<{ servicename?: string }>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
props.getServicesMetrics(params.servicename, props.globalTime);
|
props.getServicesMetrics(servicename, props.globalTime);
|
||||||
props.getTopEndpoints(params.servicename, props.globalTime);
|
props.getTopEndpoints(servicename, props.globalTime);
|
||||||
}, [props.globalTime, params.servicename]);
|
}, [props.globalTime, servicename]);
|
||||||
|
|
||||||
const onTracePopupClick = (timestamp: number) => {
|
const onTracePopupClick = (timestamp: number) => {
|
||||||
const tMinus5Min = timestamp / 1000000 - 5 * 60 * 1000;
|
const tMinus15Min = timestamp / 1000000 - 15 * 60 * 1000;
|
||||||
const currentTime = timestamp / 1000000;
|
const currentTime = timestamp / 1000000;
|
||||||
|
|
||||||
props.updateTimeInterval("custom", [
|
props.updateTimeInterval("custom", [
|
||||||
tMinus5Min,
|
tMinus15Min,
|
||||||
currentTime,
|
currentTime,
|
||||||
]); // updateTimeInterval takes second range in ms -- give -5 min to selected time,
|
]); // updateTimeInterval takes second range in ms -- give -5 min to selected time,
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams();
|
||||||
|
urlParams.set(METRICS_PAGE_QUERY_PARAM.startTime,tMinus15Min.toString())
|
||||||
|
urlParams.set(METRICS_PAGE_QUERY_PARAM.endTime,currentTime.toString())
|
||||||
|
if(servicename){
|
||||||
|
urlParams.set(METRICS_PAGE_QUERY_PARAM.service,servicename)
|
||||||
|
}
|
||||||
|
|
||||||
props.history.push(`/traces?${METRICS_PAGE_QUERY_PARAM.startTime}=${tMinus5Min}&${METRICS_PAGE_QUERY_PARAM.endTime}=${currentTime}`);
|
props.history.push(`/traces?${urlParams.toString()}`);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Tabs defaultActiveKey="1">
|
<Tabs defaultActiveKey="1">
|
||||||
|
|||||||
@ -16,6 +16,8 @@ import { FilterStateDisplay } from "./FilterStateDisplay";
|
|||||||
|
|
||||||
import FormItem from "antd/lib/form/FormItem";
|
import FormItem from "antd/lib/form/FormItem";
|
||||||
import metricsAPI from "../../api/metricsAPI";
|
import metricsAPI from "../../api/metricsAPI";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { METRICS_PAGE_QUERY_PARAM } from "../../constants/query";
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
@ -39,12 +41,20 @@ interface TagKeyOptionItem {
|
|||||||
|
|
||||||
const _TraceFilter = (props: TraceFilterProps) => {
|
const _TraceFilter = (props: TraceFilterProps) => {
|
||||||
const [serviceList, setServiceList] = useState<string[]>([]);
|
const [serviceList, setServiceList] = useState<string[]>([]);
|
||||||
|
const [service, setSelectedService] = useState<string|null>(null);
|
||||||
const [operationList, setOperationsList] = useState<string[]>([]);
|
const [operationList, setOperationsList] = useState<string[]>([]);
|
||||||
const [tagKeyOptions, setTagKeyOptions] = useState<TagKeyOptionItem[]>([]);
|
const [tagKeyOptions, setTagKeyOptions] = useState<TagKeyOptionItem[]>([]);
|
||||||
|
const location = useLocation()
|
||||||
|
const urlParams = new URLSearchParams(location.search.split("?")[1]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
metricsAPI.get<string[]>("services/list").then((response) => {
|
metricsAPI.get<string[]>("services/list").then((response) => {
|
||||||
setServiceList(response.data);
|
setServiceList(response.data);
|
||||||
|
}).then(()=>{
|
||||||
|
const serviceName =urlParams.get(METRICS_PAGE_QUERY_PARAM.service);
|
||||||
|
if(serviceName){
|
||||||
|
handleChangeService(serviceName)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
export enum METRICS_PAGE_QUERY_PARAM {
|
export enum METRICS_PAGE_QUERY_PARAM {
|
||||||
interval = "interval",
|
interval = "interval",
|
||||||
startTime = "startTime",
|
startTime = "startTime",
|
||||||
endTime = "endTime"
|
endTime = "endTime",
|
||||||
|
service = "service"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user