import React, { useEffect, useState } from "react"; import { Tabs, Card, Row, Col } from "antd"; import { connect } from "react-redux"; import { useParams, RouteComponentProps } from "react-router-dom"; import { withRouter } from "react-router"; import { getServicesMetrics, metricItem, getTopEndpoints, topEndpointListItem, GlobalTime, updateTimeInterval, } from "../../actions"; import { StoreState } from "../../reducers"; import LatencyLineChart from "./LatencyLineChart"; import RequestRateChart from "./RequestRateChart"; import ErrorRateChart from "./ErrorRateChart"; import TopEndpointsTable from "./TopEndpointsTable"; import { METRICS_PAGE_QUERY_PARAM } from "../../constants/query"; const { TabPane } = Tabs; interface ServicesMetricsProps extends RouteComponentProps { serviceMetrics: metricItem[]; getServicesMetrics: Function; topEndpointsList: topEndpointListItem[]; getTopEndpoints: Function; globalTime: GlobalTime; updateTimeInterval: Function; } const _ServiceMetrics = (props: ServicesMetricsProps) => { const {servicename} = useParams<{ servicename?: string }>(); useEffect(() => { props.getServicesMetrics(servicename, props.globalTime); props.getTopEndpoints(servicename, props.globalTime); }, [props.globalTime, servicename]); const onTracePopupClick = (timestamp: number) => { const tMinus15Min = timestamp / 1000000 - 15 * 60 * 1000; const currentTime = timestamp / 1000000; props.updateTimeInterval("custom", [ tMinus15Min, currentTime, ]); // 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?${urlParams.toString()}`); }; return (
Coming Soon..
{/* */}
{/* */}
); }; const mapStateToProps = ( state: StoreState, ): { serviceMetrics: metricItem[]; topEndpointsList: topEndpointListItem[]; globalTime: GlobalTime; } => { return { serviceMetrics: state.serviceMetrics, topEndpointsList: state.topEndpointsList, globalTime: state.globalTime, }; }; export const ServiceMetrics = withRouter( connect(mapStateToProps, { getServicesMetrics: getServicesMetrics, getTopEndpoints: getTopEndpoints, updateTimeInterval: updateTimeInterval, })(_ServiceMetrics), );