Skip to content

Commit 2594c53

Browse files
authored
Merge pull request #65 from oslabs-beta/dev
Chronos 6.0
2 parents 96847a6 + 96e4643 commit 2594c53

File tree

110 files changed

+10899
-3572
lines changed

Some content is hidden

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

110 files changed

+10899
-3572
lines changed

.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
declare module '*.png'
1+
declare module '*.png'

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,48 @@
1+
# JS Project-Specific #
2+
#######################
13
node_modules
2-
.eslintrc.js
3-
.DS_Store
44
dist
55
build
6+
release-builds
67
coverage
78
__tests__/**/__snapshots__
8-
release-builds
9+
.env
10+
11+
# Compiled source #
12+
###################
13+
*.com
14+
*.class
15+
*.dll
16+
*.exe
17+
*.o
18+
*.so
19+
20+
# Packages #
21+
############
22+
# it's better to unpack these files and commit the raw source
23+
# git has its own built in compression methods
24+
*.7z
25+
*.dmg
26+
*.gz
27+
*.iso
28+
*.jar
29+
*.rar
30+
*.tar
31+
*.zip
32+
33+
# Logs and databases #
34+
######################
35+
*.log
36+
*.sql
37+
*.sqlite
38+
39+
# OS generated files #
40+
######################
41+
.DS_Store
42+
.DS_Store?
43+
._*
44+
.Spotlight-V100
45+
.Trashes
46+
ehthumbs.db
47+
Thumbs.db
48+

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
123,125

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ Chronos welcomes all pull requests.
1313
5. Make sure code is formatted with `prettier` and follows the [Airbnb React/JSX Style Guide](https://github.com/airbnb/javascript/blob/master/react/README.md).
1414
6. Create a pull request to `master`.
1515

16+
## Getting started
17+
- `npm run bot`: Run Node and Electron at the same time to start Chronos app
18+
- To make changes to codebase on the Main Process
19+
- Files in the main process must be compiled prior to starting the app
20+
- In the terminal un Chronos directory, input `tsc` to comile typescript files
21+
- Once compiled, `npm run both`
22+
* Note** If typescript is not installed, `npm install -g typescript`
23+
1624
## Issues
1725

1826
Please do not hesitate to file issues. Chronos is based off of community feedback and is always looking for ways to get better. The team behind Chronos is interested to hear about your experience and how we can improve it.

README.md

Lines changed: 137 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,46 @@
1717
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.
1818

1919
## Table of Contents
20-
2120
- [Features](#features)
2221
- [Demo](#demo)
2322
- [Installation](#installation)
2423
- [Pre-Installation](#pre-installation)
2524
- [Install Dependencies](#install-dependencies)
26-
- [Configure Chronos](#configure-chronos)
27-
- [Initialize Chronos](#initialize-chronos)
25+
- [Configure Chronos Tracker](#configure-chronos-tracker)
26+
- [Initialize Chronos Tracker](#initialize-chronos-tracker)
2827
- [Docker Configuration](#docker-configuration)
28+
- [Start Chronos](#start-chronos)
2929
- [Notifications](#notifications)
3030
- [Slack](#slack)
3131
- [Email](#email)
3232
- [Branches](#branches)
33-
- [Master](#master-branch)
33+
- [Master Branch](#master-branch)
3434
- [Examples](#examples)
3535
- [Microservices](#microservices)
3636
- [Docker](#docker)
37-
- [Middleware](#middleware-branch)
37+
- [gRPC Branch](#grpc-branch)
3838
- [Technologies](#technologies)
3939
- [License](#license)
4040

4141
#
4242
###### Return to [Top](#Chronos)
4343
<br>
4444

45+
## <img src ="./app/assets/fire.png" height=22 > New Features <img src ="./app/assets/fire.png" height=24>
46+
47+
- New UI Features
48+
- Dark and Light mode options now available across user sessions.
49+
- Updated charts to now also support gRPC calls
50+
- Integrated log to provide users with relational data on request & response cycle
51+
- Bug Fixes
52+
- Fixed bug where users could only connect to one MongoDB database and would see its microservices listed even when users clicked on applications using other MongoDB databases
53+
- Chronos now support monitoring for gRPC!
54+
- Distributed tracing across network request
55+
- Currently chronos gRPC tracing for MongoDB and PostgresQL
56+
4557
## Features
4658

4759
- Distributed tracing enabled across microservices applications
48-
- Supports <a href="#"><img src="./app/assets/http-logo-color.png" alt="HTTP" title="HTTP" align="center" height="20" /></a> protocol, with <img src="./app/assets/grpc-logo-color.png" alt="gRPC" title="gRPC" align="center" height="20" /></a> _coming soon_
4960
- Compatible with <img src="./app/assets/graphql-logo-color.png" alt="GraphQL" title="GraphQL" align="center" height="20" /></a>
5061
- Provides <a href="#"><img src="./app/assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="20" /></a> container stats (e.g. ID, memory usage %, CPU usage %, running processes, etc.)
5162
- Supports <a href="#"><img src="./app/assets/postgres-logo-color.png" alt="PostgreSQL" title="PostgreSQL" align="center" height="20" /></a> and <img src="./app/assets/mongo-logo-color.png" alt="MongoDB" title="MongoDB" align="center" height="20" /></a> databases
@@ -65,8 +76,8 @@ Chronos is a comprehensive developer tool that monitors the health and web traff
6576
## Installation
6677
This is for the latest Chronos version **5.1 release and later**.
6778

68-
- Stable release: 5.1.0
69-
- LTS release: 5.0.1
79+
- Stable release: 6.1.0
80+
- LTS release: 6.1.0
7081

7182
### Pre-Installation
7283
Make sure you're running version 12.18.3 of <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /></a></a>, which is the most recent LTS (long-term support) version.
@@ -87,7 +98,7 @@ To use Chronos in your existing application, download and install the following
8798
npm install chronos-tracker
8899
```
89100

90-
### Configure Chronos
101+
### Configure Chronos Tracker
91102

92103
Similarly, in the **root directory** of _each of your microservice applications_, create a `chronos-config.js` file with properties listed below:
93104

@@ -101,8 +112,9 @@ chronos.use({
101112
interval: 2000,
102113
dockerized: true,
103114
database: {
115+
connection: 'REST',
104116
type: 'MongoDB',
105-
URI: process.env.MONGO_URI,
117+
URI: process.env.URI,
106118
},
107119
notifications: [],
108120
});
@@ -115,6 +127,7 @@ The `interval` property is optional and takes in an integer. This controls the C
115127
The `dockerized` property is optional and should be specified as `true` if the server is running inside of a Docker container. Otherwise, this should be `false`. If omitted, Chronos will assume this server is not running in a container.
116128

117129
The `database` property is required and takes in the following:
130+
- `connection` which should be a string and only supports 'REST' and 'gRPC'
118131
- `type` which should be a string and only supports 'MongoDB' and 'PostgreSQL'.
119132
- `URI` which should be a connection string the database you intend Chronos to write and record data regarding health, HTTP route tracing, and container infomation to. A `.env` is recommended.
120133

@@ -126,14 +139,16 @@ The `notifications` property is optional. Jump to the section below, [Notificati
126139
<br>
127140
<br>
128141

129-
### Initialize Chronos
142+
### Initialize Chronos Tracker
143+
#### Initialize Chronos Tracker for REST
130144

131145
Wherever you create an instance of your server (see example below),
132146

133147
```js
134-
// Example
148+
// Example for REST
135149
const express = require('express');
136150
const app = express());
151+
137152
```
138153

139154
you will also need to require in `chronos-tracker` and initialize Chronos, as well as the `./chronos-config` file. You will then need to invoke `chronos.propagate()` to initiate the route tracing, in addition to implementing `chronos.track()` for all endpoints.
@@ -149,8 +164,110 @@ app.use('/', chronos.track());
149164
```
150165

151166
You should be good to go! The last step, **Docker Configuration**, is **only applicable** if you need to configure <a href="#"><img src="./app/assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="20" /></a> for your application.
167+
152168
<br>
153169

170+
171+
#### Initialize Chronos Tracker for gRPC
172+
173+
Wherever you create an instance of your server (see example below),
174+
175+
176+
```js
177+
// Example of gRPC server
178+
const server = new grpc.Server();
179+
180+
server.bindAsync("127.0.0.1:30044", grpc. ServerCredentials.createInsecure(), () => {
181+
server.start();
182+
console.log("Server running at http://127.0.0.1:30044");
183+
});
184+
```
185+
you will also need to require Chronos-tracker, Chronos-config, and dotenv.config(if this is used). For health data simply use Chronos.track()
186+
187+
188+
189+
```js
190+
//track health data
191+
const chronos = require('chronos-tracker');
192+
require('./chronos-config');
193+
require('dotenv').config(); // set up environment variables in .env
194+
const BookModel = require('./BookModel');
195+
196+
chronos.track()
197+
```
198+
To trace requests, first wrap the gRPC client using Chronos
199+
```js
200+
const grpc = require('@grpc/grpc-js');
201+
const protoLoader = require('@grpc/proto-loader');
202+
const chronos = require('chronos');
203+
204+
const PROTO_PATH = './order.proto';
205+
206+
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
207+
keepCase: true,
208+
longs: String,
209+
enums: String,
210+
arrays: true,
211+
});
212+
const OrderToBookService = grpc.loadPackageDefinition(packageDefinition).OrderToBook;
213+
const bookClient = new OrderToBookService('localhost:30044', grpc.credentials.createInsecure());
214+
215+
const ClientWrapper = chronos.ClientWrapper(bookClient, OrderToBookService);
216+
```
217+
Next wrap the gRPC server using Chronos
218+
```js
219+
220+
const ServerWrapper = chronos.ServerWrapper(server, Proto.protoname.service, {
221+
AddBook: (call, callback) => {
222+
// console.log(call.metadata)
223+
// get the properties from the gRPC client call
224+
const { title, author, numberOfPages, publisher, bookID } = call.request;
225+
// create a book in our book collection
226+
BookModel.create({
227+
title,
228+
author,
229+
numberOfPages,
230+
publisher,
231+
bookID,
232+
});
233+
callback(null, {});
234+
},
235+
});
236+
})
237+
```
238+
For any request you wish to trace, require uuidv4 and write the following code where the initial gRPC request begins,
239+
```js
240+
const require { v4: uuidv4} = require('uuid')
241+
const createMeta = () => {
242+
const meta = new grpc.Metadata();
243+
meta.add('id', uuidvd());
244+
return meta
245+
}
246+
```
247+
and then invoke createMeta as a third argument to any client method that is the beginning of the request path.
248+
249+
```js
250+
orderClient.AddOrder(
251+
order,
252+
(err, data) => {
253+
if (err !== null) {
254+
console.log(err);
255+
// could not add order because bookID does not exist
256+
return res.sendStatus(404);
257+
}
258+
console.log('addOrder response: ', data);
259+
return res.sendStatus(200);
260+
},
261+
createMeta()
262+
);
263+
264+
```
265+
Finally, on all servers that will be involved in the request path, invoke `chronos.link` with parameters of `client` and `ServerWrapper` in the server wrapper.
266+
267+
```js
268+
chronos.link(client, ServerWrapper);
269+
```
270+
154271
### Docker Configuration
155272

156273
Again, this step is **only applicable** if you are currently using <a href="#"><img src="./app/assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="20" /></a> containers for your microservices.
@@ -173,6 +290,11 @@ If you're using `docker-compose` to start up multiple containers, you can add a
173290
volumes:
174291
- "/var/run/docker.sock:/var/run/docker.sock"
175292
```
293+
294+
### Start Chronos
295+
296+
Once you have configured and intialized Chronos Tracker, it will be automatically recording monitoring data when your servers are running. Finally, start the Chronos desktop app to view that data! After cloning our [GitHub repo](https://github.com/open-source-labs/Chronos), run `npm install` and `npm run both` to start Chronos. Alternatively, you can download an [executable for Mac](https://chronoslany.com/Chronos.dmg). Add your application in the Chronos app dashboard with the same URI you used in your Chronos Tracker configuration. Click on it and start monitoring!
297+
176298
#
177299
###### Return to [Top](#Chronos)
178300
<br>
@@ -266,9 +388,9 @@ Refer to the [README](link) in the `docker` folder for more details.
266388

267389
<br>
268390

269-
### Middleware Branch
391+
### gRPC Branch
392+
The **'gRPC'** branch is the current codebase for the <a href="#"><img src="./app/assets/npm-logo-color.png" alt="NPM" title="NPM" align="center" height="20" /></a> package, which is what you will install in your own application in order to use Chronos. Download the <a href="#"><img src="./app/assets/npm-logo-color.png" alt="NPM" title="NPM" align="center" height="20" /></a> package [here](https://www.npmjs.com/package/chronos-tracker).
270393

271-
The **'middleware'** branch is the current codebase for the <a href="#"><img src="./app/assets/npm-logo-color.png" alt="NPM" title="NPM" align="center" height="20" /></a> package, which is what you will install in your own application in order to use Chronos. Download the <a href="#"><img src="./app/assets/npm-logo-color.png" alt="NPM" title="NPM" align="center" height="20" /></a> package [here](https://www.npmjs.com/package/chronos-tracker).
272394
<br>
273395

274396
#
@@ -286,7 +408,7 @@ The **'middleware'** branch is the current codebase for the <a href="#"><img src
286408
- <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="30" /></a>
287409
- <a href="#"><img src="./app/assets/express-logo-color.png" alt="Express" title="Express" align="center" height="30" /></a>
288410
- <a href="#"><img src="./app/assets/http-logo-color.png" alt="HTTP" title="HTTP" align="center" height="30" /></a>
289-
- <a href="#"><img src="./app/assets/grpc-logo-color.png" alt="gRPC" title="gRPC" align="center" height="30" /></a> _coming soon_
411+
- <a href="#"><img src="./app/assets/grpc-logo-color.png" alt="gRPC" title="gRPC" align="center" height="30" /></a>
290412
- <a href="#"><img src="./app/assets/graphql-logo-color.png" alt="GraphQL" title="GraphQL" align="center" height="30" /></a>
291413
- <a href="#"><img src="./app/assets/docker-logo-color.png" alt="Docker" title="Docker" align="center" height="30" /></a>
292414
- <a href="#"><img src="./app/assets/aws-logo-color.png" alt="AWS" title="AWS" align="center" height="30" /></a>

0 commit comments

Comments
 (0)