You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Fork the repo and create a working branch from `master`.
10
+
2. If you've added any code that requires testing, add tests.
11
+
3. If you've changed APIs, update the `README.md`.
12
+
4. Check to ensure that all tests pass.
13
+
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).
14
+
6. Create a pull request to `master`.
15
+
16
+
## Issues
17
+
18
+
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.
19
+
20
+
Please do not hesitate to submit issues that promote bugs or offer ways to enhance to Chronos. When submitting issues, ensure your description is clear and has instructions to be able to reproduce the issue.
21
+
22
+
## Get in touch
23
+
24
+
We use GitHub as a platform of communication between users and developers to promote transparency. We thrive off of the community support and feedback
- Temperature, speed, latency, and memory tracking
28
28
- Process monitoring
29
+
- HTTP route tracing
29
30
30
-
# Quick start
31
+
##Quick start
31
32
32
-
Install dependencies
33
+
#### Install dependencies
33
34
34
35
```
35
36
npm install chronos-tracker
36
37
```
37
38
38
-
Create `chronos-config.js` within the **same directory** as your `server.js`
39
+
#### Create a `chronos-config.js`
39
40
40
41
```js
42
+
// An example `chronos-config.js` file
43
+
41
44
constchronos=require('chronos-tracker');
42
45
43
-
cmd.use({
44
-
microservice:'chronos-mon-2',
45
-
interval:3000,
46
+
chronos.use({
47
+
microservice:'payments',
48
+
interval:2000,
46
49
dockerized:true,
47
50
database: {
48
51
type:'MongoDB',
49
-
URI:/* NEW DATABASE URI */,
52
+
URI:process.env.MONGO_URI,
50
53
},
51
-
notifications: [
52
-
{
53
-
type:'slack',
54
-
settings: {
55
-
slackurl:/* YOUR SLACK WEBHOOK URL*/,
56
-
},
57
-
},
58
-
{
59
-
type:'email',
60
-
settings: {
61
-
emails:/* EMAIL RECIPIENT LIST */,
62
-
emailHost:/* EMAIL HOST */,
63
-
emailPort:/* EMAIL PORT */,
64
-
user:/* SENDER EMAIL ADDRESS */,
65
-
password:process.env.EMAIL_PASSWORD,
66
-
},
67
-
},
68
-
],
54
+
notifications: [],
69
55
});
70
56
```
71
57
72
-
Refer to section setup for more information on these properties
73
-
74
-
75
-
_NOTE: Email notification settings may require alternative security settings to work_
58
+
**More information on configuring Chronos and setting up notifications below**
76
59
77
-
Initialize chronos
60
+
#### Initialize chronos
78
61
79
62
```js
80
63
constcmd=require('chronos-tracker');
@@ -84,14 +67,13 @@ cmd.propagate();
84
67
app.use('/', cmd.track());
85
68
```
86
69
87
-
Download Chronos to view your application data [here]()
88
-
70
+
**Download Chronos** to start monitoring your application data [here]()
89
71
<!-- # Installation
90
72
91
73
Chronos consists of a [Node](https://nodejs.org/en/) module available through the
92
74
[npm registry](https://www.npmjs.com/) and a lightweight [Electron](https://electronjs.org/) desktop application. -->
93
75
94
-
#Containerized Applications Using Docker
76
+
## Docker - Containerized Applications
95
77
96
78
IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below.
97
79
@@ -110,26 +92,76 @@ volumes:
110
92
111
93
\*Note: This module leverages the features of [systeminformation](https://systeminformation.io/).
112
94
95
+
## Configuration
96
+
97
+
The `microservice` property takes in a string. This should be the name of your server or microservice. For **Docker** containers, the name of the microservice should be the same as the name of the corresponding Docker container.
98
+
99
+
The `interval` property is optional and takes in an integer. This controls the Chronos monitoring frequency. If this is omitted, Chronos will defualt to recording server health every 2000 ms or 2 seconds.
100
+
101
+
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.
102
+
103
+
The `database` property is required and takes in the following:
104
+
-`type` which should be a string and only supports 'MongoDB' and 'PostgreSQL'.
105
+
-`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.
113
106
114
-
## Configuration Setup
115
-
116
-
-[1] microserviceName: To identify the microservice (i.e. "payments").
117
-
- Make sure this name matches your container name. More details more below (param #6).
118
-
- Your input name for the microservice will be turned to an all-lowercase string.
119
-
-[2] databaseType: Enter either "mongo" or "sql".
120
-
-[3] databaseURL: Enter the URL of your database.
121
-
-[4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
122
-
- 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.
123
-
-[5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
124
-
- "s" : every second
125
-
- "m" : every minute (default)
126
-
- "h" : every hour
127
-
- "d" : once per day
128
-
- "w" : once per week
129
107
-[6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
130
108
- 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.
131
109
- Don't forget to bind mount to Docker socket. See NEW FEATURE section above.
132
110
111
+
## Notifications
112
+
113
+
The `notifications` property is optional and allows developers to be alerted when the server responds to requests with status codes >= 400. To set up notifications, set the value of the `notifications` property to an array of objects, each with a `type` and `settings` property.
114
+
115
+
Chronos only supports **Slack** and **email** notifications.
116
+
117
+
### Slack
118
+
119
+
Chronos uses the **Slack API** to send messages to a Slack channel and only requires the **webhook url**. Learn how to set up [Slack webhooks](https://api.slack.com/messaging/webhooks) for your team.
120
+
121
+
An example of configured **slack** settings:
122
+
123
+
```js
124
+
// ...
125
+
notifications: [
126
+
{
127
+
type:'email',
128
+
settings: {
129
+
slackurl:process.env.WEBHOOK
130
+
}
131
+
}
132
+
]
133
+
// ...
134
+
```
135
+
136
+
### Email
137
+
138
+
Chronos provides the option to send emails. The properties that should be provided are the following
139
+
-`emails` - The recipient list (string) can be a single email address or multiple as comma seprated values.
140
+
-`emailHost` - The smtp host (string) of your email server
141
+
-`emailPort` - The email port (integer) is either **465** or **587** depending on the sender email security settings. Learn more about email ports at the [nodemailer docs](https://nodemailer.com/smtp/)
142
+
-`user` - The email address (string) of the sender
143
+
-`password` - The password (string) of the sender email
144
+
145
+
_NOTE: Email notification settings may require alternative security settings to work_
@@ -139,7 +171,7 @@ The microservices include individual Dockerfiles in their respective directories
139
171
140
172
Refer to the [README](https://github.com/oslabs-beta/Chronos/tree/docker/microservice) of that branch for more details.
141
173
142
-
####Electron desktop application
174
+
## Electron desktop application
143
175
144
176
After installing the node module in each microservice, download the Electron desktop application from the public [Chronos]() repo.
145
177
@@ -149,27 +181,7 @@ Inside the downloaded directory, install all dependencies using the `npm install
149
181
150
182
Development of Chronos is open source on GitHub through the tech accelerator umbrella OS Labs, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Chronos.
0 commit comments