updates Graph title and adds initial set up for db overview

This commit is contained in:
dhrubesh 2021-05-02 14:42:30 +05:30
parent eafc2919c7
commit 39012d86d7
5 changed files with 85 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import {
getServicesMetrics, getServicesMetrics,
metricItem, metricItem,
getTopEndpoints, getTopEndpoints,
getDbOverViewMetrics,
getExternalMetrics, getExternalMetrics,
externalMetricsAvgDurationItem, externalMetricsAvgDurationItem,
externalErrCodeMetricsItem, externalErrCodeMetricsItem,
@ -33,6 +34,7 @@ interface ServicesMetricsProps extends RouteComponentProps<any> {
getExternalMetrics: Function; getExternalMetrics: Function;
getExternalErrCodeMetrics: Function; getExternalErrCodeMetrics: Function;
getExternalAvgDurationMetrics: Function; getExternalAvgDurationMetrics: Function;
getDbOverViewMetrics: Function;
externalMetrics: externalMetricsItem[]; externalMetrics: externalMetricsItem[];
topEndpointsList: topEndpointListItem[]; topEndpointsList: topEndpointListItem[];
externalAvgDurationMetrics: externalMetricsAvgDurationItem[]; externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
@ -50,6 +52,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
props.getExternalMetrics(servicename, props.globalTime); props.getExternalMetrics(servicename, props.globalTime);
props.getExternalErrCodeMetrics(servicename, props.globalTime); props.getExternalErrCodeMetrics(servicename, props.globalTime);
props.getExternalAvgDurationMetrics(servicename, props.globalTime); props.getExternalAvgDurationMetrics(servicename, props.globalTime);
props.getDbOverViewMetrics(servicename, props.globalTime);
}, [props.globalTime, servicename]); }, [props.globalTime, servicename]);
const onTracePopupClick = (timestamp: number) => { const onTracePopupClick = (timestamp: number) => {
@ -108,7 +111,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
<Col span={12}> <Col span={12}>
<Card bodyStyle={{ padding: 10 }}> <Card bodyStyle={{ padding: 10 }}>
<ExternalApiGraph <ExternalApiGraph
title=" External Call Error Rate" title="External Call Error Percentage (%)"
keyIdentifier="externalHttpUrl" keyIdentifier="externalHttpUrl"
dataIdentifier="numCalls" dataIdentifier="numCalls"
data={props.externalErrCodeMetrics} data={props.externalErrCodeMetrics}
@ -129,7 +132,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
</Col> </Col>
</Row> </Row>
<Row gutter={32} style={{ margin: 20 }}> <Row gutter={32} style={{ margin: 20 }}>
<Col span={12}> <Col span={12}>
<Card bodyStyle={{ padding: 10 }}> <Card bodyStyle={{ padding: 10 }}>
<ExternalApiGraph <ExternalApiGraph
@ -154,6 +157,33 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
</Col> </Col>
</Row> </Row>
</TabPane> </TabPane>
<TabPane tab="Database Calls" key="3">
<Row gutter={32} style={{ margin: 20 }}>
<Col span={12}>
<Card bodyStyle={{ padding: 10 }}>
<ExternalApiGraph
title=" External Call Error Rate"
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>
</TabPane>
</Tabs> </Tabs>
); );
}; };
@ -186,5 +216,6 @@ export const ServiceMetrics = withRouter(
getExternalAvgDurationMetrics: getExternalAvgDurationMetrics, getExternalAvgDurationMetrics: getExternalAvgDurationMetrics,
getTopEndpoints: getTopEndpoints, getTopEndpoints: getTopEndpoints,
updateTimeInterval: updateTimeInterval, updateTimeInterval: updateTimeInterval,
getDbOverViewMetrics:getDbOverViewMetrics,
})(_ServiceMetrics), })(_ServiceMetrics),
); );

View File

@ -81,6 +81,10 @@ export interface getExternalMetricsAction {
payload: externalMetricsItem[]; payload: externalMetricsItem[];
} }
export interface getDbOverViewMetricsAction {
type: ActionTypes.getDbOverviewMetrics;
payload: externalMetricsItem[];
}
export interface getTopEndpointsAction { export interface getTopEndpointsAction {
type: ActionTypes.getTopEndpoints; type: ActionTypes.getTopEndpoints;
payload: topEndpointListItem[]; payload: topEndpointListItem[];
@ -106,6 +110,28 @@ export const getServicesList = (globalTime: GlobalTime) => {
}; };
}; };
export const getDbOverViewMetrics = (
serviceName: string,
globalTime: GlobalTime,
) => {
return async (dispatch: Dispatch) => {
let request_string =
"/service/dbOverview?service=" +
serviceName +
"&start=" +
globalTime.minTime +
"&end=" +
globalTime.maxTime +
"&step=60";
const response = await api.get<any>(apiV1 + request_string);
console.log("response", response);
// dispatch<getExternalMetricsAction>({
// type: ActionTypes.getExternalMetrics,
// payload: response.data,
// });
};
};
export const getExternalMetrics = ( export const getExternalMetrics = (
serviceName: string, serviceName: string,
globalTime: GlobalTime, globalTime: GlobalTime,

View File

@ -8,6 +8,7 @@ import {
getExternalMetricsAction, getExternalMetricsAction,
getTopEndpointsAction, getTopEndpointsAction,
getFilteredTraceMetricsAction, getFilteredTraceMetricsAction,
getDbOverViewMetricsAction,
} from "./metrics"; } from "./metrics";
import { getUsageDataAction } from "./usage"; import { getUsageDataAction } from "./usage";
import { updateTimeIntervalAction } from "./global"; import { updateTimeIntervalAction } from "./global";
@ -21,6 +22,7 @@ export enum ActionTypes {
getServiceMetrics = "GET_SERVICE_METRICS", getServiceMetrics = "GET_SERVICE_METRICS",
getAvgDurationMetrics = "GET_AVG_DURATION_METRICS", getAvgDurationMetrics = "GET_AVG_DURATION_METRICS",
getErrCodeMetrics = "GET_ERR_CODE_METRICS", getErrCodeMetrics = "GET_ERR_CODE_METRICS",
getDbOverviewMetrics = "GET_DB_OVERVIEW_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",
@ -41,4 +43,5 @@ export type Action =
| getFilteredTraceMetricsAction | getFilteredTraceMetricsAction
| getExternalMetricsAction | getExternalMetricsAction
| externalErrCodeMetricsActions | externalErrCodeMetricsActions
| getDbOverViewMetricsAction
| externalMetricsAvgDurationAction; | externalMetricsAvgDurationAction;

View File

@ -20,6 +20,7 @@ import {
externalErrCodeMetricsReducer, externalErrCodeMetricsReducer,
serviceTableReducer, serviceTableReducer,
topEndpointsReducer, topEndpointsReducer,
dbOverviewMetricsReducer,
externalMetricsReducer, externalMetricsReducer,
externalAvgDurationMetricsReducer, externalAvgDurationMetricsReducer,
} from "./metrics"; } from "./metrics";
@ -36,6 +37,7 @@ export interface StoreState {
serviceMetrics: metricItem[]; serviceMetrics: metricItem[];
topEndpointsList: topEndpointListItem[]; topEndpointsList: topEndpointListItem[];
externalMetrics: externalMetricsItem[]; externalMetrics: externalMetricsItem[];
dbOverviewMetrics: externalMetricsItem[];
externalAvgDurationMetrics: externalMetricsAvgDurationItem[]; externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
externalErrCodeMetrics: externalErrCodeMetricsItem[]; externalErrCodeMetrics: externalErrCodeMetricsItem[];
usageDate: usageDataItem[]; usageDate: usageDataItem[];
@ -50,6 +52,7 @@ const reducers = combineReducers<StoreState>({
traceItem: traceItemReducer, traceItem: traceItemReducer,
servicesList: serviceTableReducer, servicesList: serviceTableReducer,
serviceMetrics: serviceMetricsReducer, serviceMetrics: serviceMetricsReducer,
dbOverviewMetrics: dbOverviewMetricsReducer,
topEndpointsList: topEndpointsReducer, topEndpointsList: topEndpointsReducer,
externalAvgDurationMetrics: externalAvgDurationMetricsReducer, externalAvgDurationMetrics: externalAvgDurationMetricsReducer,
externalMetrics: externalMetricsReducer, externalMetrics: externalMetricsReducer,

View File

@ -125,6 +125,26 @@ export const externalMetricsReducer = (
} }
}; };
export const dbOverviewMetricsReducer = (
state: externalMetricsItem[] = [
{
avgDuration: 0,
callRate: 0,
externalHttpUrl: "",
numCalls: 0,
timestamp: 0,
},
],
action: Action,
) => {
switch (action.type) {
case ActionTypes.getDbOverviewMetrics:
return action.payload;
default:
return state;
}
};
export const filteredTraceMetricsReducer = ( export const filteredTraceMetricsReducer = (
state: customMetricsItem[] = [{ timestamp: 0, value: 0 }], state: customMetricsItem[] = [{ timestamp: 0, value: 0 }],
action: Action, action: Action,