mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-09-23 11:43:13 +08:00
adds error and external call duration graph
This commit is contained in:
parent
61c26d7727
commit
ec52ad7636
@ -1,3 +1,3 @@
|
|||||||
export const ENVIRONMENT = {
|
export const ENVIRONMENT = {
|
||||||
baseURL: "http://ec2-3-135-219-130.us-east-2.compute.amazonaws.com:8080",
|
baseURL: "",
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,8 @@ const theme = "dark";
|
|||||||
|
|
||||||
interface ExternalApiGraphProps extends RouteComponentProps<any> {
|
interface ExternalApiGraphProps extends RouteComponentProps<any> {
|
||||||
data: externalMetricsItem[];
|
data: externalMetricsItem[];
|
||||||
keyIdentifier: string;
|
keyIdentifier?: string;
|
||||||
|
label?: string;
|
||||||
title: string;
|
title: string;
|
||||||
dataIdentifier: string;
|
dataIdentifier: string;
|
||||||
fnDataIdentifier?: (s: number | string) => number | string;
|
fnDataIdentifier?: (s: number | string) => number | string;
|
||||||
@ -39,12 +40,28 @@ class ExternalApiGraph extends React.Component<ExternalApiGraphProps> {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
|
label,
|
||||||
data,
|
data,
|
||||||
dataIdentifier,
|
dataIdentifier,
|
||||||
keyIdentifier,
|
keyIdentifier,
|
||||||
fnDataIdentifier,
|
fnDataIdentifier,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const getDataSets = () => {
|
const getDataSets = () => {
|
||||||
|
if (!keyIdentifier) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: label || "",
|
||||||
|
data: data.map((s: externalMetricsItem) =>
|
||||||
|
fnDataIdentifier
|
||||||
|
? fnDataIdentifier(s[dataIdentifier])
|
||||||
|
: s[dataIdentifier],
|
||||||
|
),
|
||||||
|
pointRadius: 0.5,
|
||||||
|
borderColor: borderColors[0],
|
||||||
|
borderWidth: 2,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
const uniq = uniqBy(data, keyIdentifier);
|
const uniq = uniqBy(data, keyIdentifier);
|
||||||
return uniq.map((obj: externalMetricsItem, i: number) => {
|
return uniq.map((obj: externalMetricsItem, i: number) => {
|
||||||
const _data = filter(
|
const _data = filter(
|
||||||
|
@ -9,7 +9,11 @@ import {
|
|||||||
metricItem,
|
metricItem,
|
||||||
getTopEndpoints,
|
getTopEndpoints,
|
||||||
getExternalMetrics,
|
getExternalMetrics,
|
||||||
|
externalMetricsAvgDurationItem,
|
||||||
|
externalErrCodeMetricsItem,
|
||||||
externalMetricsItem,
|
externalMetricsItem,
|
||||||
|
getExternalAvgDurationMetrics,
|
||||||
|
getExternalErrCodeMetrics,
|
||||||
topEndpointListItem,
|
topEndpointListItem,
|
||||||
GlobalTime,
|
GlobalTime,
|
||||||
updateTimeInterval,
|
updateTimeInterval,
|
||||||
@ -26,9 +30,13 @@ const { TabPane } = Tabs;
|
|||||||
interface ServicesMetricsProps extends RouteComponentProps<any> {
|
interface ServicesMetricsProps extends RouteComponentProps<any> {
|
||||||
serviceMetrics: metricItem[];
|
serviceMetrics: metricItem[];
|
||||||
getServicesMetrics: Function;
|
getServicesMetrics: Function;
|
||||||
getExternalMetrics: Function;g
|
getExternalMetrics: Function;
|
||||||
|
getExternalErrCodeMetrics: Function;
|
||||||
|
getExternalAvgDurationMetrics: Function;
|
||||||
externalMetrics: externalMetricsItem[];
|
externalMetrics: externalMetricsItem[];
|
||||||
topEndpointsList: topEndpointListItem[];
|
topEndpointsList: topEndpointListItem[];
|
||||||
|
externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
|
||||||
|
externalErrCodeMetrics: externalErrCodeMetricsItem[];
|
||||||
getTopEndpoints: Function;
|
getTopEndpoints: Function;
|
||||||
globalTime: GlobalTime;
|
globalTime: GlobalTime;
|
||||||
updateTimeInterval: Function;
|
updateTimeInterval: Function;
|
||||||
@ -40,6 +48,8 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
|||||||
props.getServicesMetrics(servicename, props.globalTime);
|
props.getServicesMetrics(servicename, props.globalTime);
|
||||||
props.getTopEndpoints(servicename, props.globalTime);
|
props.getTopEndpoints(servicename, props.globalTime);
|
||||||
props.getExternalMetrics(servicename, props.globalTime);
|
props.getExternalMetrics(servicename, props.globalTime);
|
||||||
|
props.getExternalErrCodeMetrics(servicename, props.globalTime);
|
||||||
|
props.getExternalAvgDurationMetrics(servicename, props.globalTime);
|
||||||
}, [props.globalTime, servicename]);
|
}, [props.globalTime, servicename]);
|
||||||
|
|
||||||
const onTracePopupClick = (timestamp: number) => {
|
const onTracePopupClick = (timestamp: number) => {
|
||||||
@ -94,12 +104,33 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
|||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
||||||
<TabPane tab="External Calls" key="2">
|
<TabPane tab="External Calls" key="2">
|
||||||
<div
|
<Row gutter={32} style={{ margin: 20 }}>
|
||||||
className="container"
|
<Col span={12}>
|
||||||
style={{ display: "flex", flexFlow: "column wrap" }}
|
<Card bodyStyle={{ padding: 10 }}>
|
||||||
>
|
<ExternalApiGraph
|
||||||
<div className="row">
|
title="External Call RPS(by Address)"
|
||||||
<div className="col-md-6 col-sm-12 col-12">
|
keyIdentifier="externalHttpUrl"
|
||||||
|
dataIdentifier="numCalls"
|
||||||
|
data={props.externalErrCodeMetrics}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col span={12}>
|
||||||
|
<Card bodyStyle={{ padding: 10 }}>
|
||||||
|
<ExternalApiGraph
|
||||||
|
label="Average Duration"
|
||||||
|
title="External Call duration"
|
||||||
|
dataIdentifier="avgDuration"
|
||||||
|
fnDataIdentifier={(s) => Number(s) / 1000000}
|
||||||
|
data={props.externalAvgDurationMetrics}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
<Row gutter={32} style={{ margin: 20 }}>
|
||||||
|
<Col span={12}>
|
||||||
<Card bodyStyle={{ padding: 10 }}>
|
<Card bodyStyle={{ padding: 10 }}>
|
||||||
<ExternalApiGraph
|
<ExternalApiGraph
|
||||||
title="External Call RPS(by Address)"
|
title="External Call RPS(by Address)"
|
||||||
@ -108,8 +139,9 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
|||||||
data={props.externalMetrics}
|
data={props.externalMetrics}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</Col>
|
||||||
<div className="col-md-6 col-sm-12 col-12">
|
|
||||||
|
<Col span={12}>
|
||||||
<Card bodyStyle={{ padding: 10 }}>
|
<Card bodyStyle={{ padding: 10 }}>
|
||||||
<ExternalApiGraph
|
<ExternalApiGraph
|
||||||
title="External Call duration(by Address)"
|
title="External Call duration(by Address)"
|
||||||
@ -119,9 +151,8 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
|
|||||||
data={props.externalMetrics}
|
data={props.externalMetrics}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</Col>
|
||||||
</div>
|
</Row>
|
||||||
</div>
|
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
);
|
);
|
||||||
@ -132,14 +163,18 @@ const mapStateToProps = (
|
|||||||
): {
|
): {
|
||||||
serviceMetrics: metricItem[];
|
serviceMetrics: metricItem[];
|
||||||
topEndpointsList: topEndpointListItem[];
|
topEndpointsList: topEndpointListItem[];
|
||||||
|
externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
|
||||||
|
externalErrCodeMetrics: externalErrCodeMetricsItem[];
|
||||||
externalMetrics: externalMetricsItem[];
|
externalMetrics: externalMetricsItem[];
|
||||||
globalTime: GlobalTime;
|
globalTime: GlobalTime;
|
||||||
} => {
|
} => {
|
||||||
return {
|
return {
|
||||||
|
externalErrCodeMetrics: state.externalErrCodeMetrics,
|
||||||
serviceMetrics: state.serviceMetrics,
|
serviceMetrics: state.serviceMetrics,
|
||||||
topEndpointsList: state.topEndpointsList,
|
topEndpointsList: state.topEndpointsList,
|
||||||
externalMetrics: state.externalMetrics,
|
externalMetrics: state.externalMetrics,
|
||||||
globalTime: state.globalTime,
|
globalTime: state.globalTime,
|
||||||
|
externalAvgDurationMetrics: state.externalAvgDurationMetrics,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -147,6 +182,8 @@ export const ServiceMetrics = withRouter(
|
|||||||
connect(mapStateToProps, {
|
connect(mapStateToProps, {
|
||||||
getServicesMetrics: getServicesMetrics,
|
getServicesMetrics: getServicesMetrics,
|
||||||
getExternalMetrics: getExternalMetrics,
|
getExternalMetrics: getExternalMetrics,
|
||||||
|
getExternalErrCodeMetrics: getExternalErrCodeMetrics,
|
||||||
|
getExternalAvgDurationMetrics: getExternalAvgDurationMetrics,
|
||||||
getTopEndpoints: getTopEndpoints,
|
getTopEndpoints: getTopEndpoints,
|
||||||
updateTimeInterval: updateTimeInterval,
|
updateTimeInterval: updateTimeInterval,
|
||||||
})(_ServiceMetrics),
|
})(_ServiceMetrics),
|
||||||
|
@ -27,6 +27,17 @@ export interface metricItem {
|
|||||||
errorRate: number;
|
errorRate: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface externalMetricsAvgDurationItem {
|
||||||
|
avgDuration: number;
|
||||||
|
timestamp: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface externalErrCodeMetricsItem {
|
||||||
|
callRate: number;
|
||||||
|
externalHttpUrl: string;
|
||||||
|
numCalls: number;
|
||||||
|
timestamp: number;
|
||||||
|
}
|
||||||
export interface topEndpointListItem {
|
export interface topEndpointListItem {
|
||||||
p50: number;
|
p50: number;
|
||||||
p90: number;
|
p90: number;
|
||||||
@ -53,6 +64,14 @@ export interface getServicesListAction {
|
|||||||
payload: servicesListItem[];
|
payload: servicesListItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface externalErrCodeMetricsActions {
|
||||||
|
type: ActionTypes.getErrCodeMetrics;
|
||||||
|
payload: externalErrCodeMetricsItem[];
|
||||||
|
}
|
||||||
|
export interface externalMetricsAvgDurationAction {
|
||||||
|
type: ActionTypes.getAvgDurationMetrics;
|
||||||
|
payload: externalMetricsAvgDurationItem[];
|
||||||
|
}
|
||||||
export interface getServiceMetricsAction {
|
export interface getServiceMetricsAction {
|
||||||
type: ActionTypes.getServiceMetrics;
|
type: ActionTypes.getServiceMetrics;
|
||||||
payload: metricItem[];
|
payload: metricItem[];
|
||||||
@ -101,7 +120,6 @@ export const getExternalMetrics = (
|
|||||||
globalTime.maxTime +
|
globalTime.maxTime +
|
||||||
"&step=60";
|
"&step=60";
|
||||||
const response = await api.get<externalMetricsItem[]>(apiV1 + request_string);
|
const response = await api.get<externalMetricsItem[]>(apiV1 + request_string);
|
||||||
console.log("response", response);
|
|
||||||
dispatch<getExternalMetricsAction>({
|
dispatch<getExternalMetricsAction>({
|
||||||
type: ActionTypes.getExternalMetrics,
|
type: ActionTypes.getExternalMetrics,
|
||||||
payload: response.data,
|
payload: response.data,
|
||||||
@ -109,6 +127,53 @@ export const getExternalMetrics = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getExternalAvgDurationMetrics = (
|
||||||
|
serviceName: string,
|
||||||
|
globalTime: GlobalTime,
|
||||||
|
) => {
|
||||||
|
return async (dispatch: Dispatch) => {
|
||||||
|
let request_string =
|
||||||
|
"/service/externalAvgDuration?service=" +
|
||||||
|
serviceName +
|
||||||
|
"&start=" +
|
||||||
|
globalTime.minTime +
|
||||||
|
"&end=" +
|
||||||
|
globalTime.maxTime +
|
||||||
|
"&step=60";
|
||||||
|
|
||||||
|
const response = await api.get<externalMetricsAvgDurationItem[]>(
|
||||||
|
apiV1 + request_string,
|
||||||
|
);
|
||||||
|
dispatch<externalMetricsAvgDurationAction>({
|
||||||
|
type: ActionTypes.getAvgDurationMetrics,
|
||||||
|
payload: response.data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export const getExternalErrCodeMetrics = (
|
||||||
|
serviceName: string,
|
||||||
|
globalTime: GlobalTime,
|
||||||
|
) => {
|
||||||
|
return async (dispatch: Dispatch) => {
|
||||||
|
let request_string =
|
||||||
|
"/service/externalErrors?service=" +
|
||||||
|
serviceName +
|
||||||
|
"&start=" +
|
||||||
|
globalTime.minTime +
|
||||||
|
"&end=" +
|
||||||
|
globalTime.maxTime +
|
||||||
|
"&step=60";
|
||||||
|
const response = await api.get<externalErrCodeMetricsItem[]>(
|
||||||
|
apiV1 + request_string,
|
||||||
|
);
|
||||||
|
console.log("Re", response);
|
||||||
|
dispatch<externalErrCodeMetricsActions>({
|
||||||
|
type: ActionTypes.getErrCodeMetrics,
|
||||||
|
payload: response.data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const getServicesMetrics = (
|
export const getServicesMetrics = (
|
||||||
serviceName: string,
|
serviceName: string,
|
||||||
globalTime: GlobalTime,
|
globalTime: GlobalTime,
|
||||||
|
@ -3,6 +3,8 @@ import { updateTraceFiltersAction, updateInputTagAction } from "./traceFilters";
|
|||||||
import {
|
import {
|
||||||
getServicesListAction,
|
getServicesListAction,
|
||||||
getServiceMetricsAction,
|
getServiceMetricsAction,
|
||||||
|
externalErrCodeMetricsActions,
|
||||||
|
externalMetricsAvgDurationAction,
|
||||||
getExternalMetricsAction,
|
getExternalMetricsAction,
|
||||||
getTopEndpointsAction,
|
getTopEndpointsAction,
|
||||||
getFilteredTraceMetricsAction,
|
getFilteredTraceMetricsAction,
|
||||||
@ -17,6 +19,8 @@ export enum ActionTypes {
|
|||||||
fetchTraceItem = "FETCH_TRACE_ITEM",
|
fetchTraceItem = "FETCH_TRACE_ITEM",
|
||||||
getServicesList = "GET_SERVICE_LIST",
|
getServicesList = "GET_SERVICE_LIST",
|
||||||
getServiceMetrics = "GET_SERVICE_METRICS",
|
getServiceMetrics = "GET_SERVICE_METRICS",
|
||||||
|
getAvgDurationMetrics = "GET_AVG_DURATION_METRICS",
|
||||||
|
getErrCodeMetrics = "GET_ERR_CODE_METRICS",
|
||||||
getExternalMetrics = "GET_EXTERNAL_METRICS",
|
getExternalMetrics = "GET_EXTERNAL_METRICS",
|
||||||
getTopEndpoints = "GET_TOP_ENDPOINTS",
|
getTopEndpoints = "GET_TOP_ENDPOINTS",
|
||||||
getUsageData = "GET_USAGE_DATE",
|
getUsageData = "GET_USAGE_DATE",
|
||||||
@ -35,4 +39,6 @@ export type Action =
|
|||||||
| getUsageDataAction
|
| getUsageDataAction
|
||||||
| updateTimeIntervalAction
|
| updateTimeIntervalAction
|
||||||
| getFilteredTraceMetricsAction
|
| getFilteredTraceMetricsAction
|
||||||
| getExternalMetricsAction;
|
| getExternalMetricsAction
|
||||||
|
| externalErrCodeMetricsActions
|
||||||
|
| externalMetricsAvgDurationAction;
|
||||||
|
@ -6,8 +6,10 @@ import {
|
|||||||
metricItem,
|
metricItem,
|
||||||
topEndpointListItem,
|
topEndpointListItem,
|
||||||
externalMetricsItem,
|
externalMetricsItem,
|
||||||
|
externalMetricsAvgDurationItem,
|
||||||
usageDataItem,
|
usageDataItem,
|
||||||
GlobalTime,
|
GlobalTime,
|
||||||
|
externalErrCodeMetricsItem,
|
||||||
customMetricsItem,
|
customMetricsItem,
|
||||||
TraceFilters,
|
TraceFilters,
|
||||||
} from "../actions";
|
} from "../actions";
|
||||||
@ -15,9 +17,11 @@ import { updateGlobalTimeReducer } from "./global";
|
|||||||
import {
|
import {
|
||||||
filteredTraceMetricsReducer,
|
filteredTraceMetricsReducer,
|
||||||
serviceMetricsReducer,
|
serviceMetricsReducer,
|
||||||
|
externalErrCodeMetricsReducer,
|
||||||
serviceTableReducer,
|
serviceTableReducer,
|
||||||
topEndpointsReducer,
|
topEndpointsReducer,
|
||||||
externalMetricsReducer,
|
externalMetricsReducer,
|
||||||
|
externalAvgDurationMetricsReducer,
|
||||||
} from "./metrics";
|
} from "./metrics";
|
||||||
import { traceFiltersReducer, inputsReducer } from "./traceFilters";
|
import { traceFiltersReducer, inputsReducer } from "./traceFilters";
|
||||||
import { traceItemReducer, tracesReducer } from "./traces";
|
import { traceItemReducer, tracesReducer } from "./traces";
|
||||||
@ -32,6 +36,8 @@ export interface StoreState {
|
|||||||
serviceMetrics: metricItem[];
|
serviceMetrics: metricItem[];
|
||||||
topEndpointsList: topEndpointListItem[];
|
topEndpointsList: topEndpointListItem[];
|
||||||
externalMetrics: externalMetricsItem[];
|
externalMetrics: externalMetricsItem[];
|
||||||
|
externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
|
||||||
|
externalErrCodeMetrics: externalErrCodeMetricsItem[];
|
||||||
usageDate: usageDataItem[];
|
usageDate: usageDataItem[];
|
||||||
globalTime: GlobalTime;
|
globalTime: GlobalTime;
|
||||||
filteredTraceMetrics: customMetricsItem[];
|
filteredTraceMetrics: customMetricsItem[];
|
||||||
@ -45,7 +51,9 @@ const reducers = combineReducers<StoreState>({
|
|||||||
servicesList: serviceTableReducer,
|
servicesList: serviceTableReducer,
|
||||||
serviceMetrics: serviceMetricsReducer,
|
serviceMetrics: serviceMetricsReducer,
|
||||||
topEndpointsList: topEndpointsReducer,
|
topEndpointsList: topEndpointsReducer,
|
||||||
|
externalAvgDurationMetrics: externalAvgDurationMetricsReducer,
|
||||||
externalMetrics: externalMetricsReducer,
|
externalMetrics: externalMetricsReducer,
|
||||||
|
externalErrCodeMetrics: externalErrCodeMetricsReducer,
|
||||||
usageDate: usageDataReducer,
|
usageDate: usageDataReducer,
|
||||||
globalTime: updateGlobalTimeReducer,
|
globalTime: updateGlobalTimeReducer,
|
||||||
filteredTraceMetrics: filteredTraceMetricsReducer,
|
filteredTraceMetrics: filteredTraceMetricsReducer,
|
||||||
|
@ -4,8 +4,10 @@ import {
|
|||||||
servicesListItem,
|
servicesListItem,
|
||||||
metricItem,
|
metricItem,
|
||||||
topEndpointListItem,
|
topEndpointListItem,
|
||||||
|
externalErrCodeMetricsItem,
|
||||||
customMetricsItem,
|
customMetricsItem,
|
||||||
externalMetricsItem,
|
externalMetricsItem,
|
||||||
|
externalMetricsAvgDurationItem,
|
||||||
} from "../actions";
|
} from "../actions";
|
||||||
|
|
||||||
export const serviceTableReducer = (
|
export const serviceTableReducer = (
|
||||||
@ -67,6 +69,42 @@ export const topEndpointsReducer = (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const externalAvgDurationMetricsReducer = (
|
||||||
|
state: externalMetricsAvgDurationItem[] = [
|
||||||
|
{
|
||||||
|
avgDuration: 0,
|
||||||
|
timestamp: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
action: Action,
|
||||||
|
) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case ActionTypes.getAvgDurationMetrics:
|
||||||
|
return action.payload;
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const externalErrCodeMetricsReducer = (
|
||||||
|
state: externalErrCodeMetricsItem[] = [
|
||||||
|
{
|
||||||
|
callRate: 0,
|
||||||
|
externalHttpUrl: "",
|
||||||
|
numCalls: 0,
|
||||||
|
timestamp: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
action: Action,
|
||||||
|
) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case ActionTypes.getErrCodeMetrics:
|
||||||
|
return action.payload;
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const externalMetricsReducer = (
|
export const externalMetricsReducer = (
|
||||||
state: externalMetricsItem[] = [
|
state: externalMetricsItem[] = [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user