Skip to content

Commit 85af74e

Browse files
authored
Merge pull request #29 from Umius-Brian/Launch
Nice work on fixing docker stats component sizing issue and cleaning up front-end file struct.!
2 parents 74d5e9d + f68161e commit 85af74e

37 files changed

+1647
-1604
lines changed

.DS_Store

4 KB
Binary file not shown.

README.md

Lines changed: 71 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,93 @@
11
![Chronos logo](https://raw.githubusercontent.com/Chronos2-0/Chronos/master/app/assets/logo2.png)
22
## Chronos
3-
Microservice communication and health visualizer.
4-
5-
[![NPM Version][npm-image]][npm-url]
6-
[![NPM Downloads][downloads-image]][downloads-url]
7-
8-
```js
9-
const cmd = require('chronos-microservice-debugger3')
10-
cmd.propagate()
11-
12-
app.use('/', cmd.microCom('microserviceName', 'databaseType', 'databaseURL', 'wantMicroHealth', 'queryFrequency'))
13-
```
3+
Microservice communication, health, and Docker container visualizer.
4+
Comes with a middleware and an Electron app.
145

156
## Features
167

8+
* NEW (3.0+): Docker container stats (e.g. ID, memory usage %, CPU usage %, running processes, etc.) (New middleware compiled from TypeScript.)
179
* HTTP request tracing
1810
* Speed and latency tracking
1911
* Process monitoring
2012
* Memory usage
2113

14+
## NEW FEATURE FOR 3.0+ - Logging Docker Container Stats
15+
16+
IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below.
17+
18+
IMPORTANT: In order to have container stats saved to your database along with other health info, when starting up the containers, bind volumes to this path:
19+
`/var/run/docker.sock`
20+
21+
For example, you can type the following when starting up a container:
22+
`docker run -v /var/run/docker.sock:/var/run/docker.sock [your-image-tag]`
23+
24+
If you're using docker-compose to start up multiple containers at once, you can add a `volumes` key for each of your services in the YAML file:
25+
```
26+
volumes:
27+
- "/var/run/docker.sock:/var/run/docker.sock"
28+
```
29+
30+
*Note: This module leverages the features of [systeminformation](https://systeminformation.io/).
31+
2232
## Installation
2333

2434
Chronos consists of a [Node](https://nodejs.org/en/) module available through the
2535
[npm registry](https://www.npmjs.com/) and a lightweight [Electron](https://electronjs.org/) desktop application.
2636

2737
#### Node module
2838

29-
To begin, install the [Chronos](https://www.npmjs.com/package/chronos-microservice-debugger3) node module within each microservice of your application using the
39+
To begin, install the [Chronos](https://www.npmjs.com/package/chronos-microservice-debugger4) node module within each microservice of your application using the
3040
[`npm install`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)command:
3141

3242
```
33-
npm install chronos-microservice-debugger3
43+
npm install chronos-microservice-debugger4
3444
```
3545

3646
Once installed, write the following two lines at the top of each microservice's server file:
3747
```javascript
38-
const cmd = require('chronos-microservice-debugger3');
48+
const cmd = require('chronos-microservice-debugger4');
3949
cmd.propagate();
4050
```
4151

4252
Then add a route handler for all incoming requests:
4353
```js
44-
app.use('/', cmd.microCom('microserviceName', 'databaseType', 'databaseURL', 'wantMicroHealth', 'queryFrequency'))
54+
app.use('/',
55+
cmd.microCom(
56+
'microserviceName',
57+
'databaseType',
58+
'databaseURL',
59+
'wantMicroHealth',
60+
'queryFrequency',
61+
'isDockerized'
62+
)
63+
)
4564
```
4665

4766
The cmd.microCom handler function logs communication and health data to a user-provided database. This is to ensure that your private data stays private. We currently support MongoDB and SQL/PostgreSQL databases.
4867

49-
cmd.microCom takes four parameters and an optional fifth parameter. You can enter the arguments as individual strings or as an array.
68+
cmd.microCom takes six parameters. You can enter the arguments as individual strings or as an array.
5069

5170
The parameters are:
52-
1. microserviceName: To identify the microservice (i.e. "payments")
53-
2. databaseType: Enter either "mongo" or "sql"
54-
3. databaseURL: Enter the URL of your database
55-
4. wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no"
56-
5. queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
57-
* "s" : every second
58-
* "m" : every minute (default)
59-
* "h" : every hour
60-
* "d" : once per day
61-
* "w" : once per week
71+
* [1] microserviceName: To identify the microservice (i.e. "payments").
72+
- Make sure this name matches your container name. More details more below (param #6).
73+
- Your input name for the microservice will be turned to an all-lowercase string.
74+
* [2] databaseType: Enter either "mongo" or "sql".
75+
* [3] databaseURL: Enter the URL of your database.
76+
* [4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
77+
- Note: If you choose "yes" for this param, the middleware will NOT log container stats. In other words, if you want container stats instead, input "no" here and "yes" for param #6.
78+
* [5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
79+
- "s" : every second
80+
- "m" : every minute (default)
81+
- "h" : every hour
82+
- "d" : once per day
83+
- "w" : once per week
84+
* [6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
85+
- IMPORTANT: When starting up the container, give it the same name that you used for the microservice, because the middleware finds the correct container ID of your container by matching the container name to the microservice name you input as 1st argument.
86+
- Don't forget to bind mount to Docker socket. See NEW FEATURE section above.
6287

6388
String parameter example:
6489
```javascript
65-
app.use('/', cmd.microCom('payments', 'mongo', 'mongodb+srv://user:[email protected]/','yes','h'))
90+
app.use('/', cmd.microCom('payments', 'mongo', 'mongodb+srv://user:[email protected]/','yes','m','no'))
6691
```
6792

6893
Array parameter example:
@@ -71,16 +96,24 @@ let values = [
7196
'payments',
7297
'mongo',
7398
'mongodb+srv://user:[email protected]/',
74-
'yes',
75-
'h'
99+
'no',
100+
'h',
101+
'yes'
76102
]
77103

78104
app.use('/', cmd.microCom(values)
79105
```
106+
#### Microservice Test Suite
107+
108+
Additionally, the repo includes a test suite of microservices utilizing the Chronos node module so that their communication, health, and container data can be logged. You can then visualize the data with the Electron app.
109+
110+
The microservices include individual Dockerfiles in their respective directories. A docker-compose.yml is in the root directory in case you'd like to deploy all services together.
111+
112+
Refer to the [README](https://github.com/oslabs-beta/Chronos/tree/docker/microservice) of that branch for more details.
80113
81114
#### Electron desktop application
82115
83-
After installing the node module in each microservice, download the Electron desktop application from the public [Chronos](https://github.com/Chronos2-0/Chronos) repo.
116+
After installing the node module in each microservice, download the Electron desktop application from the public [Chronos](https://github.com/oslabs-beta/Chronos) repo.
84117
85118
Inside the downloaded directory, install all dependencies using the `npm install` command followed by the `npm start` command to start the Electron desktop application.
86119
@@ -90,6 +123,13 @@ Chronos hopes to inspire an active community of both users and developers. For q
90123
91124
## People
92125
126+
* v3 Team:
127+
[Alan Lee](https://github.com/ajlee12/),
128+
[Alon Ofengart](https://github.com/alon25),
129+
[Brian Bui](https://github.com/Umius-Brian),
130+
[Brianna Sookhoo](https://github.com/briannasookhoo)
131+
132+
* Previous teams who laid the foundation and put in invaluable work:
93133
[Tim Atapagra](https://github.com/timpagra),
94134
[Mohtasim Chowdhury](https://github.com/mohtasim317),
95135
[Ousman Diallo](https://github.com/Dialloousman),
@@ -102,9 +142,4 @@ Chronos hopes to inspire an active community of both users and developers. For q
102142
103143
## License
104144
105-
[MIT](LICENSE)
106-
107-
[npm-image]: https://img.shields.io/npm/v/chronos-microservice-debugger3.svg
108-
[npm-url]: https://www.npmjs.com/package/chronos-microservice-debugger3
109-
[downloads-image]: https://img.shields.io/npm/dm/chronos-microservice-debugger3.svg
110-
[downloads-url]: https://npmjs.org/package/chronos-microservice-debugger3
145+
[MIT](https://github.com/oslabs-beta/Chronos/blob/master/LICENSE.md)

app/.DS_Store

0 Bytes
Binary file not shown.

app/assets/chartModal.png

-22.9 KB
Binary file not shown.

app/assets/icons/icon.png

-761 KB
Binary file not shown.

app/assets/latencyChart.png

-93.5 KB
Binary file not shown.

app/assets/memoryChart.png

-8.28 KB
Binary file not shown.

app/assets/pieChart.png

-47.3 KB
Binary file not shown.

app/assets/processingChart.png

-56 KB
Binary file not shown.

app/assets/routeChart.png

-87.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)