Skip to content

Commit ccd96c9

Browse files
authored
Merge pull request #5 from oslabs-beta/ChronosTeam/ecs-final
Chronos team/ecs final
2 parents 2e4826b + 83f04aa commit ccd96c9

File tree

88 files changed

+3233
-1024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3233
-1024
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ coverage
88
__tests__/**/__snapshots__
99
.env
1010
databases.txt
11+
settings.json
1112

1213
# Compiled source #
1314
###################

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

README.md

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010
![Release: 5.2](https://img.shields.io/badge/Release-5.1-orange)
1111

1212
#
13-
# Chronos
1413

14+
# Chronos
1515

1616
### Star us on GitHub — it helps!
17+
1718
Visit our splash page at [chronoslany.com](https://chronoslany.com/)
1819

19-
Chronos is a comprehensive developer tool that monitors the health and web traffic of servers, microservices, and containers. Use Chronos to see real-time data monitoring and receive automated notifications over Slack or email.
20+
Chronos is a comprehensive developer tool that monitors the health and web traffic of servers, microservices, containers, and now, Amazon Web Services (AWS). Use Chronos to see real-time data monitoring and receive automated notifications over Slack or email.
2021

2122
#
2223

2324
## What's New?
24-
- Metric query tool so you can filter out specific metrics — now you only have to see what you want on the dashboard and reduce database bloat, keeping your database from being overwhelmed with data points that you don't actually need.
25-
- Kubernetes metrics monitoring via Prometheus.
26-
- Additional metrics added, bringing Chronos up from only 12 to 100+ metrics that are currently available
27-
- Option to filter by category and individual metric, and flip between services and categories with ease
28-
- Apache Kafka monitoring capability, all you need to do is run Prometheus JMX exporter on the system your Chronos application is running on. A sample JMX config.yaml file is provided in the Chronos repository for a quick and easy setup, however you are free to configure however you like.
25+
26+
- Option to choose between cloud hosted services and local services, now giving Chronos the ability to monitor instances and clusters on AWS' EC2 and ECS platforms.
27+
- An updated AWS Graphs Container to dynamically render plots for EC2 or ECS data fetched with electron using event listeners connecting to AWS CloudWatch w/ the aws-sdk package
28+
- A step-by-step instruction on setting up a new, functional EC2 instance and/or ECS cluster, ready to be monitored and tested by the app
2929
- Bug fixes and UI tweaks — Chronos is now a more seamless experience than ever.
3030

31-
## Features
31+
## Features
3232

3333
- Distributed tracing enabled across microservices applications
3434
- Kubernetes monitoring via Prometheus server
@@ -38,22 +38,26 @@ Chronos is a comprehensive developer tool that monitors the health and web traff
3838
- Display and compare multiple microservice metrics in a single graph
3939
- Monitor an <a href="#"><img src="assets/pngwing.com.png" alt="Apache Kafka" title="Apache Kafka" align="center" height="20" /></a> cluster via the JMX Prometheus Exporter
4040
- Monitor a Kubernetes cluster via a Prometheus monitoring server
41+
- Monitor Amazon Web Services (AWS) instances and clusters <img src="assets/aws-logo-color.png" alt="AWS" title="AWS" align="center" height="20" /></a>
4142

4243
#
4344

4445
## Installation
46+
4547
This is for the latest Chronos **version 8 release**.
4648

47-
**NOTE:** The Chronos tracker code is included in the *chronos_npm_package* folder for ease of development, but the published npm package can be downloaded by running `npm install @chronosmicro/tracker`
49+
**NOTE:** The Chronos tracker code is included in the _chronos_npm_package_ folder for ease of development, but the published npm package can be downloaded by running `npm install @chronosmicro/tracker`
4850

4951
<br>
5052

5153
### Node Version
52-
Make sure you're running version 16.17.1 of <img src="assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" />, to align with the <img src="assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /> version used by <img src="assets/electron-logo-color.png" alt="Electron" title="Electron" align="center" height="20" /> version 22.
54+
55+
Make sure you're running version 16.17.1 of <img src="assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" />, to align with the <img src="assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /> version used by <img src="assets/electron-logo-color.png" alt="Electron" title="Electron" align="center" height="20" /> version 22.
5356

5457
<br>
5558

5659
### WSL2 Environment
60+
5761
If you wish to launch the Electron Application in an WSL2 envirronment(Ubuntu) you may need the following commands for an Electron window to appear
5862

5963
- Install <a href='https://sourceforge.net/projects/vcxsrv/'>VcXsrv</a>
@@ -65,36 +69,43 @@ sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0
6569
```
6670

6771
- After running your VcXsrv instance, run the following command in the terminal
72+
6873
```
6974
export DISPLAY="`sed -n 's/nameserver //p' /etc/resolv.conf`:0"
7075
```
7176

7277
<br>
7378

7479
### Running the Chronos Desktop App in Development Mode
80+
7581
1. From the root directory, run `npm install`
7682
2. Open a terminal and run `npm run dev:app` to start the Webpack development server
7783
3. Open another terminal and run `npm run dev:electron` to start the Electron UI in development mode
7884

7985
### Packing the Chronos App into an Executable
86+
8087
1. From the root directory, run `npm run build`
8188
2. Run `npm package`
8289
3. Find the `chronos.app` executable inside the newly created `release-builds` folder in the root directory.
8390

8491
#
8592

8693
## Chronos Tracker Microservice Examples
94+
8795
We provide three working example microservice applications branch for you to test out Chronos:
88-
- *examples/microservices*
89-
- *examples/docker*
90-
- *examples/kubernetes*
96+
97+
- _examples/microservices_
98+
- _examples/docker_
99+
- _examples/kubernetes_
91100

92101
#### _Microservices_
93-
In the `microservices` folder, we provide a sample microservice application that successfully utilizes Chronos to apply all the powerful, built-in features of our monitoring tool. You can then visualize the data with the <img src="assets/electron-logo-color.png" alt="Electron" title="Electron" align="center" height="20" /></a> app.
102+
103+
In the `microservices` folder, we provide a sample microservice application that successfully utilizes Chronos to apply all the powerful, built-in features of our monitoring tool. You can then visualize the data with the <img src="assets/electron-logo-color.png" alt="Electron" title="Electron" align="center" height="20" /></a> app.
94104

95105
Refer to the [README](link) in the `microservices` folder for more details.
96106

97107
#### _Docker_
108+
98109
In the <a href="#"><img src="assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="20" /></a> folder within the `master` branch, we provide a sample _dockerized_ microservices application to test out Chronos and to apply distributed tracing across different containers for your testing convenience.
99110

100111
The `docker` folder includes individual <a href="#"><img src="assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="20" /></a> files in their respective directories. A docker-compose.yml is in the root directory in case you'd like to deploy all services together.
@@ -104,18 +115,32 @@ Refer to the [README](link) in the `docker` folder for more details.
104115
<br>
105116

106117
#### _Kubernetes_
107-
The `kubernetes` folder includes a React frontend and an Express server backend, and the Dockerfiles needed to containerize them for Kubernetes deployment. The *launch* folder includes the YAML files needed to configure the deployments, services, and configurations of the frontend, backend, and Prometheus server.
108118

119+
The `kubernetes` folder includes a React frontend and an Express server backend, and the Dockerfiles needed to containerize them for Kubernetes deployment. The _launch_ folder includes the YAML files needed to configure the deployments, services, and configurations of the frontend, backend, and Prometheus server.
109120

110121
Refer to the [README](link) in the `kubernetes` folder for more details.
111122

112123
<br>
113124

114-
## Chronos Website
125+
#### _AWS_
126+
127+
The `AWS` folder includes 2 example applications with instructions on how to deploy them in AWS platforms. Note that using AWS services may cause charges.
128+
129+
- The ECS folder includes an web applciation ready to be containerized using Docker. The instruction shows how to deploy application to ECS using Docker CLI command, and it will be managed by Fargate services.
130+
- The EC2 folder includes a React/Redux/SQL web application ready to be containerized using Docker. The instruction shows how to deploy application using AWS Beanstalk and connect application to RDS database. Beanstalk service will generate EC2 instance.
131+
132+
Refer to the ECS [README](link) and EC2 [README](link) in the `AWS` folder for more details.
133+
134+
<br>
135+
136+
## Chronos Website
137+
115138
The `chronosWebsite` branch holds the code for the splash page. Edit the website by checking out the branch, modifying the website, and then updating the AWS S3 bucket with the changes.
116139

117140
#
141+
118142
###### Return to [Top](#chronos)
143+
119144
<br>
120145

121146
## Technologies
@@ -129,7 +154,7 @@ The `chronosWebsite` branch holds the code for the splash page. Edit the website
129154
- <a href="#"><img src="assets/node-logo-color.png" alt="Node" title="Node" align="center" height="30" /></a>
130155
- <a href="#"><img src="assets/express-logo-color.png" alt="Express" title="Express" align="center" height="30" /></a>
131156
- <a href="#"><img src="assets/http-logo-color.png" alt="HTTP" title="HTTP" align="center" height="30" /></a>
132-
- <a href="#"><img src="assets/grpc-logo-color.png" alt="gRPC" title="gRPC" align="center" height="30" /></a>
157+
- <a href="#"><img src="assets/grpc-logo-color.png" alt="gRPC" title="gRPC" align="center" height="30" /></a>
133158
- <a href="#"><img src="assets/graphql-logo-color.png" alt="GraphQL" title="GraphQL" align="center" height="30" /></a>
134159
- <a href="#"><img src="assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="30" /></a>
135160
- <a href="#"><img src="assets/aws-logo-color.png" alt="AWS" title="AWS" align="center" height="30" /></a>
@@ -147,10 +172,13 @@ The `chronosWebsite` branch holds the code for the splash page. Edit the website
147172
Development of Chronos is open source on GitHub through the tech accelerator umbrella OS Labs, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving Chronos.
148173

149174
- [Contributing](https://github.com/oslabs-beta/Chronos/blob/master/CONTRIBUTING.md)
175+
150176
#
151177

152178
## License
153179

154180
Chronos is [MIT licensed.](https://github.com/oslabs-beta/Chronos/blob/master/LICENSE.md)
181+
155182
#
183+
156184
###### Return to [Top](#chronos)

app/App.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@ import React, { useState } from 'react';
22
import Splash from './components/Splash';
33
import DashboardContainer from './containers/DashboardContainer';
44
import './stylesheets/scrollBar.scss';
5-
import { QueryClient, QueryClientProvider } from 'react-query';
6-
import { ReactQueryDevtools } from 'react-query/devtools'
7-
8-
const queryClient = new QueryClient();
95

106
const App: React.FC = React.memo(() => {
117
return (
12-
<QueryClientProvider client={queryClient}>
13-
<ReactQueryDevtools initialIsOpen={false} />
8+
<div>
149
<Splash />
1510
<DashboardContainer />
16-
</QueryClientProvider>
17-
18-
)
11+
</div>
12+
);
1913
});
2014

2115
export default App;

app/assets/aws-icon-white.png

11.7 KB
Loading

app/assets/aws-icon-whitebg.png

92.4 KB
Loading

app/charts/AwsChart.tsx

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import moment from 'moment';
2+
import React, { useState } from 'react';
3+
import Plot from 'react-plotly.js';
4+
import { all, solo as soloStyle } from './sizeSwitch';
5+
6+
// interface AwsCpuChartProps {
7+
// key: string;
8+
// renderService: string;
9+
// metric: string;
10+
// timeList: any;
11+
// valueList: any;
12+
// sizing: string;
13+
// colourGenerator: Function;
14+
// }
15+
16+
interface SoloStyles {
17+
height: number;
18+
width: number;
19+
}
20+
21+
const AwsChart: React.FC<any> = React.memo(props => {
22+
const { renderService, metric, timeList, valueList, colourGenerator } = props;
23+
const [solo, setSolo] = useState<SoloStyles | null>(null);
24+
setInterval(() => {
25+
if (solo !== soloStyle) {
26+
setSolo(soloStyle);
27+
}
28+
}, 20);
29+
30+
const createChart = () => {
31+
const timeArr = timeList?.map((el: any) => moment(el).format('kk:mm:ss'));
32+
// const hashedColour = colourGenerator(renderService);
33+
let plotlyData: {
34+
name: any;
35+
x: any;
36+
y: any;
37+
type: any;
38+
mode: any;
39+
marker: { color: string };
40+
};
41+
plotlyData = {
42+
name: metric,
43+
x: timeArr,
44+
y: valueList,
45+
type: 'scattergl',
46+
mode: 'lines',
47+
marker: { color: colourGenerator() },
48+
};
49+
// const sizeSwitch = sizing === 'all' ? all : solo;
50+
51+
return (
52+
<Plot
53+
data={[plotlyData]}
54+
config={{ displayModeBar: false }}
55+
layout={{
56+
title: `${renderService} | ${metric}`,
57+
// ...sizeSwitch,
58+
font: {
59+
color: '#444d56',
60+
size: 11.5,
61+
family: 'Roboto',
62+
},
63+
paper_bgcolor: 'white',
64+
plot_bgcolor: 'white',
65+
showlegend: true,
66+
legend: {
67+
orientation: 'h',
68+
xanchor: 'center',
69+
x: 0.5,
70+
y: 5,
71+
},
72+
xaxis: {
73+
title: 'Time',
74+
tickmode: 'auto',
75+
tick0: 0,
76+
dtick: 10,
77+
rangemode: 'nonnegative',
78+
mirror: false,
79+
ticks: 'outside',
80+
showline: true,
81+
},
82+
yaxis: {
83+
rangemode: 'nonnegative',
84+
title: metric,
85+
},
86+
}}
87+
/>
88+
);
89+
};
90+
91+
return (
92+
<div className="chart" data-testid="Health Chart">
93+
{
94+
createChart()
95+
}
96+
</div>
97+
);
98+
});
99+
100+
export default AwsChart;

app/components/AwsEC2Graphs.tsx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React, { useContext, useEffect, useState } from 'react';
2+
import AwsChart from '../charts/AwsChart';
3+
import { AwsContext } from '../context/AwsContext';
4+
import { CircularProgress } from '@material-ui/core';
5+
import zIndex from '@material-ui/core/styles/zIndex';
6+
7+
const AwsEC2Graphs: React.FC = React.memo(props => {
8+
const { awsData, setAwsData } = useContext(AwsContext);
9+
const [isLoading, setLoadingState] = useState<boolean>(true);
10+
11+
useEffect(() => {
12+
if (awsData) setLoadingState(false);
13+
}, []);
14+
15+
useEffect(() => {
16+
return () => {
17+
setAwsData({ CPUUtilization: [], NetworkIn: [], NetworkOut: [], DiskReadBytes: [] });
18+
};
19+
}, []);
20+
21+
const stringToColor = (string: string, recurses = 0) => {
22+
if (recurses > 20) return string;
23+
function hashString(str: string) {
24+
let hash = 0;
25+
for (let i = 0; i < str.length; i++) {
26+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
27+
}
28+
let colour = '#';
29+
for (let i = 0; i < 3; i++) {
30+
const value = (hash >> (i * 8)) & 0xff;
31+
colour += `00${value.toString(16)}`.substring(-2);
32+
}
33+
34+
console.log(colour);
35+
return colour;
36+
}
37+
};
38+
39+
return (
40+
<div className="charts">
41+
{isLoading && (
42+
<div
43+
style={{
44+
display: 'flex',
45+
width: 100,
46+
height: 100,
47+
justifyContent: 'center',
48+
position: 'absolute',
49+
alignItems: 'center',
50+
zIndex: 50,
51+
}}
52+
>
53+
<CircularProgress />
54+
</div>
55+
)}
56+
{Object.keys(awsData)?.map(metric => {
57+
return (
58+
<AwsChart
59+
className="chart"
60+
key={`Chart${metric}`}
61+
renderService={metric}
62+
metric={awsData[metric][0]?.unit}
63+
timeList={awsData[metric]?.map(el => el.time)}
64+
valueList={awsData[metric]?.map(el => el.value)}
65+
colourGenerator={stringToColor}
66+
/>
67+
);
68+
})}
69+
</div>
70+
);
71+
});
72+
73+
export default AwsEC2Graphs;

0 commit comments

Comments
 (0)