Skip to content

Commit 7325724

Browse files
authored
Merge pull request #7 from oslabs-beta/dev
Merging final changes with new AWS feature
2 parents 4de5224 + 59c65d0 commit 7325724

File tree

101 files changed

+14691
-381
lines changed

Some content is hidden

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

101 files changed

+14691
-381
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](https://github.com/oslabs-beta/Chronos/blob/dev/examples/AWS/AWS-ECS/README.md) and EC2 [README](https://github.com/oslabs-beta/Chronos/blob/dev/examples/AWS/AWS-EC2/README.md) 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)

__tests__/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Testing
2+
3+
### Preparation
4+
5+
1. React Testing Library versions 13+ require React v18. If your project uses an older version of React, be sure to install version 12
6+
```
7+
npm install --save-dev @testing-library/react@12
8+
9+
```
10+
2. install additional packages
11+
```
12+
npm install -g jest
13+
npm i @jest/types
14+
npm i ts-jest
15+
npm i jest-environment-jsdom
16+
npm i --save-dev @types/jest
17+
npm i @types/node
18+
```
19+
3. create jest.config.js
20+
```
21+
module.exports = {
22+
verbose: true,
23+
setupFilesAfterEnv: ['./jest_setup/windowMock.js'],
24+
testEnvironment: "jsdom",
25+
preset: 'ts-jest/presets/js-with-ts',
26+
moduleNameMapper: {
27+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
28+
'<rootDir>/jest_setup/fileMock.js',
29+
'\\.(css|less|scss)$': '<rootDir>/jest_setup/styleMock.js',
30+
},
31+
collectCoverage: true,
32+
types: ["jest","node"],
33+
};
34+
```
35+
4. make sure jest_setup folder is at root directory of Chronos with styleMock.js and windowMock.js
36+
37+
styleMock.js
38+
```
39+
module.exports = {};
40+
```
41+
windowMock.js
42+
```
43+
// Mock window environment
44+
window.require = require;
45+
46+
// Mock import statements for Plotly
47+
window.URL.createObjectURL = () => {};
48+
49+
// Mock get context
50+
HTMLCanvasElement.prototype.getContext = () => {};
51+
```
52+
5. update database info inside test_settings.json
53+
54+
6. use `npm run test` to run jest tests
55+
56+
### Contributing
57+
58+
Chronos hopes to inspire an active community of both users and developers. For questions, comments, or contributions, please submit a pull request.
59+
60+
### People
61+
[Snow X. Bai](https://github.com/xueapp)
62+
[Taylor Zhang](https://github.com/taylrzhang)
63+
[Tim Lee](https://github.com/timlee12)
64+
[Roberto Meloni](https://github.com/RobertoRueMeloni)

__tests__/test_settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[
44
"chronosDB",
55
"MongoDB",
6-
"mongodb+srv://troyprejusa:[email protected]/test?retryWrites=true&w=majority",
6+
"PUT YOUR MONGO URI HERE",
77
"",
88
"Dec 19, 2022 4:50 PM"
99
]

app/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import './stylesheets/scrollBar.scss';
55

66
const App: React.FC = React.memo(() => {
77
return (
8-
<>
8+
<div>
99
<Splash />
1010
<DashboardContainer />
11-
</>
12-
13-
)
11+
</div>
12+
);
1413
});
1514

1615
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;

0 commit comments

Comments
 (0)