Commit 25803e66 authored by dhrubesh's avatar dhrubesh
Browse files

integrated API, populates graph data

parent 39012d86
Showing with 30 additions and 18 deletions
+30 -18
...@@ -91,6 +91,7 @@ export const getOptions = (theme: string): ChartOptions => { ...@@ -91,6 +91,7 @@ export const getOptions = (theme: string): ChartOptions => {
}; };
export const borderColors = [ export const borderColors = [
"#00feff",
"rgba(227, 74, 51, 1.0)", "rgba(227, 74, 51, 1.0)",
"rgba(250,174,50,1)", "rgba(250,174,50,1)",
"#058b00", "#058b00",
...@@ -99,7 +100,6 @@ export const borderColors = [ ...@@ -99,7 +100,6 @@ export const borderColors = [
"#45a1ff", "#45a1ff",
"#ffe900", "#ffe900",
"#30e60b", "#30e60b",
"#00feff",
"#8000d7", "#8000d7",
"#ededf0" "#ededf0"
]; ];
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
externalMetricsAvgDurationItem, externalMetricsAvgDurationItem,
externalErrCodeMetricsItem, externalErrCodeMetricsItem,
externalMetricsItem, externalMetricsItem,
dbOverviewMetricsItem,
getExternalAvgDurationMetrics, getExternalAvgDurationMetrics,
getExternalErrCodeMetrics, getExternalErrCodeMetrics,
topEndpointListItem, topEndpointListItem,
...@@ -30,6 +31,7 @@ const { TabPane } = Tabs; ...@@ -30,6 +31,7 @@ const { TabPane } = Tabs;
interface ServicesMetricsProps extends RouteComponentProps<any> { interface ServicesMetricsProps extends RouteComponentProps<any> {
serviceMetrics: metricItem[]; serviceMetrics: metricItem[];
dbOverviewMetrics: dbOverviewMetricsItem[];
getServicesMetrics: Function; getServicesMetrics: Function;
getExternalMetrics: Function; getExternalMetrics: Function;
getExternalErrCodeMetrics: Function; getExternalErrCodeMetrics: Function;
...@@ -132,7 +134,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => { ...@@ -132,7 +134,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
...@@ -163,10 +165,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => { ...@@ -163,10 +165,10 @@ 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="Database Calls RPS"
keyIdentifier="externalHttpUrl" keyIdentifier="dbSystem"
dataIdentifier="numCalls" dataIdentifier="callRate"
data={props.externalErrCodeMetrics} data={props.dbOverviewMetrics}
/> />
</Card> </Card>
</Col> </Col>
...@@ -175,10 +177,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => { ...@@ -175,10 +177,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
<Card bodyStyle={{ padding: 10 }}> <Card bodyStyle={{ padding: 10 }}>
<ExternalApiGraph <ExternalApiGraph
label="Average Duration" label="Average Duration"
title="External Call duration" title="DataBase Calls Avg Duration"
dataIdentifier="avgDuration" dataIdentifier="avgDuration"
fnDataIdentifier={(s) => Number(s) / 1000000} fnDataIdentifier={(s) => Number(s) / 1000000}
data={props.externalAvgDurationMetrics} data={props.dbOverviewMetrics}
/> />
</Card> </Card>
</Col> </Col>
...@@ -196,6 +198,7 @@ const mapStateToProps = ( ...@@ -196,6 +198,7 @@ const mapStateToProps = (
externalAvgDurationMetrics: externalMetricsAvgDurationItem[]; externalAvgDurationMetrics: externalMetricsAvgDurationItem[];
externalErrCodeMetrics: externalErrCodeMetricsItem[]; externalErrCodeMetrics: externalErrCodeMetricsItem[];
externalMetrics: externalMetricsItem[]; externalMetrics: externalMetricsItem[];
dbOverviewMetrics: dbOverviewMetricsItem[];
globalTime: GlobalTime; globalTime: GlobalTime;
} => { } => {
return { return {
...@@ -204,6 +207,7 @@ const mapStateToProps = ( ...@@ -204,6 +207,7 @@ const mapStateToProps = (
topEndpointsList: state.topEndpointsList, topEndpointsList: state.topEndpointsList,
externalMetrics: state.externalMetrics, externalMetrics: state.externalMetrics,
globalTime: state.globalTime, globalTime: state.globalTime,
dbOverviewMetrics: state.dbOverviewMetrics,
externalAvgDurationMetrics: state.externalAvgDurationMetrics, externalAvgDurationMetrics: state.externalAvgDurationMetrics,
}; };
}; };
...@@ -216,6 +220,6 @@ export const ServiceMetrics = withRouter( ...@@ -216,6 +220,6 @@ export const ServiceMetrics = withRouter(
getExternalAvgDurationMetrics: getExternalAvgDurationMetrics, getExternalAvgDurationMetrics: getExternalAvgDurationMetrics,
getTopEndpoints: getTopEndpoints, getTopEndpoints: getTopEndpoints,
updateTimeInterval: updateTimeInterval, updateTimeInterval: updateTimeInterval,
getDbOverViewMetrics:getDbOverViewMetrics, getDbOverViewMetrics: getDbOverViewMetrics,
})(_ServiceMetrics), })(_ServiceMetrics),
); );
...@@ -54,6 +54,14 @@ export interface externalMetricsItem { ...@@ -54,6 +54,14 @@ export interface externalMetricsItem {
timestamp: number; timestamp: number;
} }
export interface dbOverviewMetricsItem {
avgDuration: number;
callRate: number;
dbSystem: string;
numCalls: number;
timestamp: number;
}
export interface customMetricsItem { export interface customMetricsItem {
timestamp: number; timestamp: number;
value: number; value: number;
...@@ -83,7 +91,7 @@ export interface getExternalMetricsAction { ...@@ -83,7 +91,7 @@ export interface getExternalMetricsAction {
export interface getDbOverViewMetricsAction { export interface getDbOverViewMetricsAction {
type: ActionTypes.getDbOverviewMetrics; type: ActionTypes.getDbOverviewMetrics;
payload: externalMetricsItem[]; payload: dbOverviewMetricsItem[];
} }
export interface getTopEndpointsAction { export interface getTopEndpointsAction {
type: ActionTypes.getTopEndpoints; type: ActionTypes.getTopEndpoints;
...@@ -123,12 +131,11 @@ export const getDbOverViewMetrics = ( ...@@ -123,12 +131,11 @@ export const getDbOverViewMetrics = (
"&end=" + "&end=" +
globalTime.maxTime + globalTime.maxTime +
"&step=60"; "&step=60";
const response = await api.get<any>(apiV1 + request_string); const response = await api.get<dbOverviewMetricsItem[]>(apiV1 + request_string);
console.log("response", response); dispatch<getDbOverViewMetricsAction>({
// dispatch<getExternalMetricsAction>({ type: ActionTypes.getDbOverviewMetrics,
// type: ActionTypes.getExternalMetrics, payload: response.data,
// payload: response.data, });
// });
}; };
}; };
......
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
externalErrCodeMetricsItem, externalErrCodeMetricsItem,
customMetricsItem, customMetricsItem,
externalMetricsItem, externalMetricsItem,
dbOverviewMetricsItem,
externalMetricsAvgDurationItem, externalMetricsAvgDurationItem,
} from "../actions"; } from "../actions";
...@@ -126,11 +127,11 @@ export const externalMetricsReducer = ( ...@@ -126,11 +127,11 @@ export const externalMetricsReducer = (
}; };
export const dbOverviewMetricsReducer = ( export const dbOverviewMetricsReducer = (
state: externalMetricsItem[] = [ state: dbOverviewMetricsItem[] = [
{ {
avgDuration: 0, avgDuration: 0,
callRate: 0, callRate: 0,
externalHttpUrl: "", dbSystem: "",
numCalls: 0, numCalls: 0,
timestamp: 0, timestamp: 0,
}, },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment