Skip to content

Ben tim/testing #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 214 commits into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
fcc279b
Initial electron app configuration.
mesherrera Sep 14, 2019
d843f28
Merge pull request #2 from oslabs-beta/testelectron
mesherrera Sep 14, 2019
7fe5326
Added file structure for redux. Edited webpack config to work with js…
mesherrera Sep 15, 2019
523af16
Removed redux file structure
mesherrera Sep 17, 2019
f6b2430
Updated gitignore file
mesherrera Sep 17, 2019
b3e9d42
Added uuid package to manage keys in JSX attributes.
mesherrera Sep 17, 2019
ae1258c
Used React Hooks to create a dynamic for user setup.
mesherrera Sep 17, 2019
e776210
Initial setup for managing user experience with app. Conditionals use…
mesherrera Sep 17, 2019
331c6d9
Created express backend to manage future API requests to user database.
mesherrera Sep 19, 2019
8d3e7b6
File structure to store user information.
mesherrera Sep 19, 2019
32e8084
Added dependencies for express and nodemon
mesherrera Sep 19, 2019
009e23e
Established IPC communication to the main processes to set state when…
mesherrera Sep 19, 2019
b1d8401
Established IPC connection to the main process in order to update sta…
mesherrera Sep 19, 2019
7373d4d
Established IPC connection with the render process to return state.
mesherrera Sep 19, 2019
49d81ed
Formatting change
mesherrera Sep 19, 2019
245ab23
Add files via upload
nmczormick Sep 19, 2019
ecc5538
Add files via upload
nmczormick Sep 19, 2019
9f15374
Reset to inital settings
mesherrera Sep 19, 2019
8b95994
Added comments
mesherrera Sep 19, 2019
011a548
Created reset functionality to restore state back to initial set up.
mesherrera Sep 19, 2019
0b9f75e
Added comments
mesherrera Sep 19, 2019
7628475
Editted mongoose scheme and model configuration.
mesherrera Sep 21, 2019
70507c2
Prop drilled database link.
mesherrera Sep 21, 2019
2cb318b
Created IPC connection to be used for database query. IPC connection …
mesherrera Sep 21, 2019
55caa8f
Cleaned up comments
mesherrera Sep 21, 2019
3c0b12a
Began working IPC listener to query database.
mesherrera Sep 21, 2019
6c6f5f3
Added npm packages mongoose and pg to work with databases.
mesherrera Sep 21, 2019
3ac0004
Removed broken references to data variable.
mesherrera Sep 21, 2019
3d43489
Restored componentDidMount()
mesherrera Sep 21, 2019
e15645c
Added mongoose connection.
mesherrera Sep 26, 2019
648faa3
Successfully querying user database and passing IPC back to renderer.
mesherrera Sep 26, 2019
c3edc4e
Reset to default
mesherrera Sep 26, 2019
8d8f5d5
Added dependencies for SQL and noSQL databases.
mesherrera Sep 26, 2019
2af4866
Established aynchronous IPC communication responsible for obtaining a…
mesherrera Sep 26, 2019
74e8df7
Established IPC communication to send and recieve query requests in o…
mesherrera Sep 26, 2019
c835914
Removed unnecessary prop drilling and variables.
mesherrera Sep 26, 2019
c94572d
Spelling correction.
mesherrera Sep 27, 2019
2b8e123
Removed.
mesherrera Sep 27, 2019
be10ee5
Sanitized mongoose queries to limit the fields returned. Edited chann…
mesherrera Sep 27, 2019
0810a60
Created algorithm to convert nested object to an array for easier man…
mesherrera Sep 27, 2019
b01c41e
Edited comments
mesherrera Sep 27, 2019
19d9dc5
Cleaned up code presentation.
mesherrera Sep 27, 2019
9b6d05e
Simplified how microservice data is added to state.
mesherrera Sep 28, 2019
7c449ba
Removed unnecessary files.
mesherrera Sep 28, 2019
5959abb
Reorganized IPC event listeners. Modified mongoose query (overviewReq…
mesherrera Sep 28, 2019
245def6
Added packages for Spectron and Mocha
mesherrera Sep 28, 2019
79b2871
Initial spectron test
mesherrera Sep 28, 2019
b38b869
Modified file structure to align with Spectron docs.
mesherrera Sep 28, 2019
9346903
Revised schema to align with new database structure.
mesherrera Sep 28, 2019
9812333
Replaced with mongoose-communication.js
mesherrera Sep 28, 2019
8ecb2a4
Modified format.
mesherrera Sep 28, 2019
81d5fe9
Proof of concept achieved to develop an overview of communications us…
mesherrera Sep 28, 2019
f0f1bab
Add files via upload
nmczormick Sep 28, 2019
d25a089
Merge pull request #3 from oslabs-beta/nmczormick-patch-1
nmczormick Sep 28, 2019
2612660
New default settings
mesherrera Oct 1, 2019
a303910
Removed mongod
mesherrera Oct 1, 2019
5200ccf
Converted to functional component.
mesherrera Oct 1, 2019
3f4c493
Conditional logic implemented to support users using MongoDB
mesherrera Oct 1, 2019
ee9ba65
Conditional logic implemented to support users using MongoDB
mesherrera Oct 1, 2019
1c3a8cf
Revised sign up form to reduce the amount of user input required. Imp…
mesherrera Oct 1, 2019
8f3c459
Minor changes to enable Context API incorporation.
mesherrera Oct 1, 2019
b162ae2
Created global store to managa majority of IPC communication. Impleme…
mesherrera Oct 1, 2019
f10ed37
File created.
mesherrera Oct 1, 2019
be626a2
Add files via upload
nmczormick Oct 1, 2019
4ff702a
Merge branch 'middleware' into nmczormick-patch-3
mesherrera Oct 1, 2019
5ec0e61
Merge pull request #5 from oslabs-beta/nmczormick-patch-3
mesherrera Oct 1, 2019
d64ed21
Deleting HealthInfo.js
mesherrera Oct 1, 2019
4837bc9
added styling, including logo, and added chart.js
Duane11003 Oct 2, 2019
148a7c9
added chart js
Duane11003 Oct 2, 2019
8f5b745
Added SQL support.
mesherrera Oct 2, 2019
70e6881
Added support for second mongoose collection.
mesherrera Oct 2, 2019
f9740bf
Created contexts to manage dashboard and setup props.
mesherrera Oct 2, 2019
060b5e4
Modified submit listner to support multiple microservice entries.
mesherrera Oct 2, 2019
9f15fd7
Component responsible for creating list of microservices submitted by…
mesherrera Oct 2, 2019
89a5049
Modified to support conditional logic when user is using a SQL database.
mesherrera Oct 2, 2019
2cb318f
Refactored to use setup context.
mesherrera Oct 2, 2019
cd7a3cf
Modified to support conditional redering and setup context
mesherrera Oct 2, 2019
bff4779
Reinstalled mongodb
mesherrera Oct 2, 2019
5f8c391
Merging work completed by Duane and myself.
mesherrera Oct 2, 2019
92e422c
Restoring save file
mesherrera Oct 2, 2019
248b21a
Adjusted webpack configuration for png files.
mesherrera Oct 2, 2019
97dd71b
Successfully querying Mongo communications collection and SQL communi…
mesherrera Oct 2, 2019
e7a6c1a
Implemented IPC communications to support queries for health informat…
mesherrera Oct 2, 2019
9e44a7c
Modularized component logic.
mesherrera Oct 2, 2019
7913096
Added GettingStarted.
mesherrera Oct 2, 2019
49dbba1
Successfully able to return to set up screen.
mesherrera Oct 2, 2019
be93c81
Restored prior IPC channels.
mesherrera Oct 2, 2019
a94ec61
added functinality to services dashboard where user clicks on their d…
Duane11003 Oct 2, 2019
946e590
Merge branch 'electron-react' of https://github.com/oslabs-beta/Chron…
Duane11003 Oct 2, 2019
52796bf
Format changes
mesherrera Oct 2, 2019
f17b0f2
Default settings
mesherrera Oct 2, 2019
f0f5a57
Merge conflicts resolved. Improved organization, styling and function…
mesherrera Oct 2, 2019
98e3f29
adjusted logo to be centered. also adjusted database lists on service…
Duane11003 Oct 3, 2019
d66387a
added functionality so user is required to input data into db name an…
Duane11003 Oct 3, 2019
881e5ce
Modified queries to ensure dynamic results based on the user selected…
mesherrera Oct 3, 2019
aaf4925
Modularized database connections to allow for dynamic querying.
mesherrera Oct 3, 2019
fbc9889
Removed comment
mesherrera Oct 3, 2019
4dac602
Restored default settings
mesherrera Oct 3, 2019
36f227b
Resuable functionality for querying communications database.
mesherrera Oct 3, 2019
c9871a4
Added OverviewContext
mesherrera Oct 3, 2019
951b589
Improved formatting
mesherrera Oct 3, 2019
7c30592
Resolved merge conflicts.
mesherrera Oct 3, 2019
bba63dd
Fixed mongoose connection.
mesherrera Oct 3, 2019
cbb16bb
Merge changes.
mesherrera Oct 3, 2019
264fa2a
Typo fix
mesherrera Oct 3, 2019
8584755
Refactored return.
mesherrera Oct 3, 2019
9da921b
Removed unused import.
mesherrera Oct 3, 2019
5a36aa7
Successfully fetching data. useEffect needs to be refactored.
mesherrera Oct 3, 2019
1371c77
Currently unused. Needs to be refactored.
mesherrera Oct 3, 2019
dc79e9f
this commit is just so i can pull down the latest changest. ignore
Duane11003 Oct 3, 2019
eb38c98
Successfully parsing data to show each service once on the list
mesherrera Oct 3, 2019
2e7565a
Removed unnecessary state change.
mesherrera Oct 3, 2019
8573b98
Successfully importing communication data from OVerview context. IPC …
mesherrera Oct 3, 2019
a9315ef
Implemented on click functions to render details component.
mesherrera Oct 3, 2019
d576ee5
Completed on click functions for buttons.
mesherrera Oct 3, 2019
27c1170
Edited context to share data collected from IPC communications
mesherrera Oct 3, 2019
9264416
Request chart component created using database data.
mesherrera Oct 3, 2019
daab411
Context created to save the results of IPC query response.
mesherrera Oct 3, 2019
8d90c2f
Removed unnecessary package.
mesherrera Oct 3, 2019
cab2f5e
Importing charts components.
mesherrera Oct 3, 2019
6731b72
Corrected typo.
mesherrera Oct 3, 2019
8bffbf3
Completed chart creation component for response codes.
mesherrera Oct 3, 2019
4bd0696
Template for chart creation.
mesherrera Oct 3, 2019
490685b
Fixed error in label organization.
mesherrera Oct 3, 2019
013403e
Added rendering for Response Conde chart.
mesherrera Oct 3, 2019
a9c6838
Added Bar graph to visualize memory
nmczormick Oct 3, 2019
2adf439
Tentative setup for speed chart.
mesherrera Oct 3, 2019
b78d0d2
Removed console.log
mesherrera Oct 3, 2019
a76c2e8
Added console.log statement for debugging.
mesherrera Oct 3, 2019
d471f0b
Removed unused chart logic.
mesherrera Oct 3, 2019
c4d65e3
Removed console.logs from debugging.
mesherrera Oct 3, 2019
459a059
this commit is behind...do not use
Duane11003 Oct 3, 2019
41caa7b
Added math logic.
mesherrera Oct 3, 2019
dd36f79
Removed unnecessary state hook. Fixed how data from IPC DetailsRespon…
mesherrera Oct 3, 2019
d8eb40b
Removed console.logs
mesherrera Oct 3, 2019
92592d9
Reduced scope of context.
mesherrera Oct 3, 2019
70e1248
Refactored chart.js from bar to line graph to display change in memor…
nmczormick Oct 3, 2019
dd14430
Add files via upload
nmczormick Oct 4, 2019
23a742d
Merge pull request #6 from oslabs-beta/npm-package
nmczormick Oct 4, 2019
07468bd
Merge pull request #7 from oslabs-beta/middleware
mesherrera Oct 4, 2019
ddf29d1
Update README.md
mesherrera Oct 4, 2019
8b4c983
Minor Corrections
mesherrera Oct 4, 2019
88e6c3f
Merge branch 'dev' into electron-react
mesherrera Oct 7, 2019
b34f331
Merge pull request #9 from oslabs-beta/electron-react
mesherrera Oct 7, 2019
00e403c
Removed console.logs used for debugging.
mesherrera Oct 14, 2019
4248bb3
Successfully using data from details context.
mesherrera Oct 14, 2019
d43b28d
Moved setDetails and IPC communication to onClick function for each s…
mesherrera Oct 14, 2019
11837e1
Removed unnecessary bulk used for information gathering. Passing props.
mesherrera Oct 14, 2019
ec7c73f
Format adjustments.
mesherrera Oct 14, 2019
7947844
Reorganizing file structure
mesherrera Oct 14, 2019
4925c14
Debugged errors. Needs improved logic for line graph creation.
mesherrera Oct 14, 2019
3955e21
Restored electron package lock.
mesherrera Oct 14, 2019
df1d8f1
Restored electron package lock.
mesherrera Oct 14, 2019
653304e
Middleware package.json. Added file to middleware folder.
mesherrera Oct 14, 2019
9451d3c
Updated template.
mesherrera Oct 16, 2019
50a654d
Removed cemmented out code.
mesherrera Oct 16, 2019
351ca62
old commit
Duane11003 Oct 16, 2019
fd98301
added line chart for latency
Duane11003 Oct 17, 2019
7449232
Fixed formatting
mesherrera Oct 17, 2019
2bb0296
list
mesherrera Oct 17, 2019
e0aff4e
Fixed logic to filter chart data point to only the current service vi…
mesherrera Oct 17, 2019
cace159
Completed chart logic
mesherrera Oct 17, 2019
b106689
Prop drilled to communication charts. Added completed speed chart.
mesherrera Oct 17, 2019
d01695c
latency chart in progress. determingin whether the db is SQL or noSQL
Duane11003 Oct 18, 2019
bc43e25
Completed processes chart using ChartJS.
mesherrera Oct 18, 2019
37187c9
Added props to ensure that charts rendered only have information for …
mesherrera Oct 18, 2019
be153fa
Fixed formatting
mesherrera Oct 18, 2019
2cf6990
Added finished charts.
mesherrera Oct 18, 2019
e193d01
resolving merge conflicts
Duane11003 Oct 18, 2019
cec9fd3
Add back button.
mesherrera Oct 18, 2019
4d27f8e
List updated.
mesherrera Oct 18, 2019
fdfda97
Rexolved merge conflicts
mesherrera Oct 18, 2019
28b0d41
Formatting
mesherrera Oct 18, 2019
caadba4
Added temperature Chart
mohtasim317 Oct 18, 2019
2a17a5b
Added temperature title
mohtasim317 Oct 18, 2019
5796087
we can get rid of this
mohtasim317 Oct 18, 2019
08464e6
Adding temperature chart
mohtasim317 Oct 18, 2019
d304ed9
Merging
mesherrera Oct 18, 2019
ba52019
Removing bundle.
mesherrera Oct 18, 2019
8ac9baa
Removed templates
mesherrera Oct 18, 2019
0adbf38
Formatting.
mesherrera Oct 18, 2019
aebce37
Removed duplicate file.
mesherrera Oct 18, 2019
f043850
Formatting.
mesherrera Oct 18, 2019
dcb526a
Fixed variable declaration.
mesherrera Oct 18, 2019
3af21f9
Commented out unused import.
mesherrera Oct 18, 2019
131df1e
Formatting.
mesherrera Oct 18, 2019
9ea3c22
additional styling on buttons, and h3 headers
Duane11003 Oct 18, 2019
e437cb5
Removed unnecessary useState hook.
mesherrera Oct 18, 2019
15c3011
Formatting.
mesherrera Oct 18, 2019
00eb191
Merge branch 'electron-react' of https://github.com/oslabs-beta/Chron…
mesherrera Oct 18, 2019
3998b65
Button style.
mesherrera Oct 18, 2019
0ab8cbe
Completed memory chart.
mesherrera Oct 21, 2019
2bb68a9
Added memory chart
mesherrera Oct 21, 2019
7d4d379
Commented chart files.
mesherrera Oct 21, 2019
c6bf658
Updated comments on hard coded solutions.;
mesherrera Oct 21, 2019
b3e291b
Added comments on connection functions.
mesherrera Oct 21, 2019
1e5b70f
Default settings.
mesherrera Oct 21, 2019
d62dd8a
Removed unecessary conditional statement. Added comments.
mesherrera Oct 21, 2019
ad6d38a
Removed unecessary conditional statement. Added comments.
mesherrera Oct 21, 2019
618a865
Restored defaults.
mesherrera Oct 21, 2019
a134527
Replaced GettingStarted with AddService.
mesherrera Oct 21, 2019
4379e8e
Removed unnecessary import of GettingStarted
mesherrera Oct 21, 2019
a7de58e
Removed unnecessary component.
mesherrera Oct 21, 2019
da73c1a
Updated import statement and rendered element for Add Database to Add…
mesherrera Oct 21, 2019
2670522
Added comments
mesherrera Oct 21, 2019
3beaac0
Added comments
mesherrera Oct 21, 2019
3ee80bf
Added comments
mesherrera Oct 21, 2019
1d3c334
Added comments.
mesherrera Oct 21, 2019
140a26a
Added comments
mesherrera Oct 21, 2019
08dc0a0
Merge branch 'electron-react' into dev
Dec 17, 2019
91ac1c0
Merge pull request #1 from ben-mizel/dev
jenaepen Dec 18, 2019
3d01b8d
merged dev
Dec 21, 2019
dcfc3ce
installed cmd2 in all microservices
Dec 21, 2019
db95c20
Microservice in place on every service in the network
tim-atapagra Dec 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
.eslintrc.js
package-lock.json
154 changes: 154 additions & 0 deletions Main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
const { app, BrowserWindow, ipcMain } = require('electron');
const fs = require('fs');
const path = require('path');
const connectSQL = require('./model/sql-connect');
const connectMongoose = require('./model/mongoose-connect');
const CommunicationSchema = require('./model/mongoose-communicatonSchema');
const HealthInfoSchema = require('./model/mongoose-healthInfoSchema');

let win;
function createWindow() {
win = new BrowserWindow({
width: 900,
height: 800,
icon: path.join(__dirname, 'app/assets/icons/icon.png'),
webPreferences: {
nodeIntegration: true,
},
});

// Development
win.loadURL('http://localhost:8080/');

// Production
// win.loadURL(`file://${path.join(__dirname, './dist/index.html')}`);

win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
if (win === null) {
createWindow();
}
});

// Load settings JSON and returns current setup status back to the render process.
ipcMain.on('setup', (message) => {
const state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
const { setupRequired } = state;
message.returnValue = setupRequired;
});

// Loads existing settings JSON and update settings to include new services entered by the user.
ipcMain.on('submit', (message, newService) => {
const state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// if statement is used to replace hard coded data. Hard coded data and the michelleWasHere key is needed to avoid a load error caused by Electron querying the database before a user has added or selected a database.
if (state.michelleWasHere) {
state.setupRequired = false;
state.michelleWasHere = false;
state.services = [JSON.parse(newService)];
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state));
} else {
state.setupRequired = false;
state.services.push(JSON.parse(newService));
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state));
}
});

// Load settings JSON and returns updated state back to the render process.
ipcMain.on('dashboard', (message) => {
const state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
const { services } = state;
const dashboardList = services.reduce((acc, curVal) => {
acc.push(curVal[0]);
return acc;
}, []);
message.returnValue = dashboardList;
});

// Queries the database for communications information and returns it back to the render process.
ipcMain.on('overviewRequest', (message, index) => {
const databaseType = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
).services[index][1];

if (databaseType === 'MongoDB') {
connectMongoose(index);
CommunicationSchema.find({}, (err, data) => {
if (err) {
console.log(`An error occured while querying the database: ${err}`);
message.sender.send('overviewResponse', JSON.stringify(err));
}
const queryResults = JSON.stringify(data);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('overviewResponse', queryResults);
});
}

if (databaseType === 'SQL') {
const pool = connectSQL(index);
const getCommunications = 'SELECT * FROM communications';
pool.query(getCommunications, (err, result) => {
if (err) {
console.log(err);
message.sender.send(JSON.stringify('Database info could not be retreived.'));
}
const queryResults = JSON.stringify(result.rows);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('overviewResponse', queryResults);
});
}
});

// Queries the database for computer health information and returns it back to the render process.
ipcMain.on('detailsRequest', (message, index) => {
const databaseType = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
).services[index][1];

if (databaseType === 'MongoDB') {
connectMongoose(index);
HealthInfoSchema.find({}, (err, data) => {
if (err) {
message.sender.send('detailsResponse', JSON.stringify(err));
}
const queryResults = JSON.stringify(data);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('detailsResponse', queryResults);
});
}

if (databaseType === 'SQL') {
const pool = connectSQL(index);
const getHealth = 'SELECT * FROM healthInfo';
pool.query(getHealth, (err, result) => {
if (err) {
message.sender.send('detailsResponse', JSON.stringify('Database info could not be retreived.'));
}
const queryResults = JSON.stringify(result.rows);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('detailsResponse', queryResults);
});
}
});
94 changes: 20 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,34 @@
# Chronos
Chronos consists of an NPM package to be required into a user’s microservices that intercepts all http and gRPC microservice communications, as well as monitors the health of each microservice over time. This information is written to a user-owned database (PostgreSQL or NoSQL) where it is queried and rendered by the frontend utilizing Node in conjunction with a native, cross-platform Electron desktop application with React components to ensure agreement between the frontend and database.
##Chronos Microservice Debugger
Chronos Microservice Debugger consists of an npm package with an optional Electron front end to visualize and monitor your microservices.

## Why was Chronos created?
As companies grow larger and begin to scale, they have a tendency to move from a monolithic code architecture and microservices and distributed systems architecture in order to build faster, more maintainable code.

The process of modularizing a code bases and breaking a monolith into individual services can be a daunting task. How do you break apart and re-connect these services? There is often a transitional period where valuable time is spent debugging these connections between services.

Chronos is deigned to meet the needs of companies and developers working to break down their monoliths into distributed systems by combining an NPM package together with an Electron application to monitor and assist in the debugging of their services.

## How to Install Chronos
The Chronos-Microservice-Debugger Express Middleware can be found on npm: https://www.npmjs.com/package/chronos-microservice-debugger

To install the NPM package:
## Install
```javascript
npm install chronos-microservice-debugger
```

The Chronos Electron application is in progress and will soon be availble for public download for all platforms. Please stay tuned.

## How to Use Chronos
## Usage
There are two main aspects to Chronos-Microservice-Debugger
1. Communication Monitor: Listens in on all microservice-microservice and microservice-client communication and monitors the response statuses and messages to ensure communications are making it to the correct destination successfully.
2. Health Monitor: The health monitor checks the status of your microservice every second and sends this health information to an optional electron frontend where it is visualized for easier use.

To use the npm package, there are three required parameters and an optional fourth parameter. You can enter the items as individual strings or as an array containing the three required parameters and one optional parameter.
*Communication Monitor: Listens in on all microservice-microservice and microservice-client communication and monitors the response statuses and messages to ensure communications are making it to the correct destination successfully.
*Health Monitor: The health monitor checks the status of your microservice every second and sends this health information to an optional electron frontend where it is visualized for easier use.

The parameters are:
1. microserviceName: What do you want to name the current microservice
2. databaseType: We currently support PostgreSQL and Mongo. Enter "mongo" or "sql"
3. databaseURL: Where would you like to store your information? Enter the URL to your database
4. queryFrequency: How often do you want microHealth to monitor the health of your database? It defaults to every second, but you can choose:
* "s" : The default, monitors every second
* "m" : Monitors every minute
* "h" : Monitors every hour
* "d" : Monitors once per day
* "w" : Monitors once per week

String parameter example:
```javascript
// How to use chronos-microservice-debugger
app.use('/', chronos-microservice-debgugger.microCom('microserviceName', 'databaseType', 'databaseURL'))

chronos-microservice-debugger.microHealth('microserviceName', 'databaseType', 'databaseURL', 'queryFrequency'))

// Example using string parameters
app.use('/', chronos-microservice-debugger.microCom('books', 'sql', 'thisIsMyURL'))
// Note: microCom does not utilize queryFreq because it logs all communication when an endpoint is hit

chronos-microservice-debugger.microHealth('books', 'sql', 'thisIsMyURL', 'h')
app.use('/', chronos-microservice-debugger.microCom('microserviceName', 'databaseType', 'databaseURL'))
chronos-microservice-debugger.microHealth('microserviceName', databaseType, databaseURL))
```
Chronos uses a user-owned and provided database to ensure that your private data stays private. We currently support MongoDB and SQL/PostgreSQL databases.

Array parameter example:
```javascript
let values = [
'microserviceName',
'databaseType',
'databaseURL',
'queryFrequency'
]
// How to use chronos-micrservice-debugger with an array parameter
app.use('/', chronos-microservice-debgugger.microCom(values)

chronos-microservice-debugger.microHealth(values)

// Example using an array parameter
let values = [
'books',
'mongo',
'thisIsMyNewURL',
'w'
]
## Things in the Works
*gRPC support
*Ability to determine how often your microservice health is monitored (currently every second)
*'Time Travel' to see how your microservices have changed over time
*Docker health information for containerized microservices
*Implement additional unit testing

app.use('/', chronos-microservice-debgugger.microCom(values)
// Note: microCom does not utilize queryFreq because it logs all communication when an endpoint is hit

chronos-microservice-debugger.microHealth(values)

```
## Links
*Chronos Website: http://chronos.ninja
*Gitub Page: https://github.com/oslabs-beta/Chronos

## How to Contribute to Chronos
Chronos hopes to inspire an active community of both users and developers. For questions, comments, suggestions, please contact us at teammicronos@gmail.com or submit a pull request.
## Contact Us
For questions, requests, or more information, please contact us at teammicronos@gmail.com

## Created By
* Duane McFarlane
* Michelle Herrera
* Mohtasim Chowdhury
* Natalie Umanzor
28 changes: 28 additions & 0 deletions __tests__/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { Application } = require('spectron');
const assert = require('assert');
const electronPath = require('electron');
const path = require('path');

describe('Application launch', function () {
this.timeout(10000);

beforeEach(function () {
this.app = new Application({
path: electronPath,
args: [path.join(__dirname, '..')],
});
return this.app.start();
});

afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop();
}
});

it('shows an initial window', function () {
return this.app.client.getWindowCount().then(function (count) {
assert.equal(count, 1);
});
});
});
42 changes: 42 additions & 0 deletions __tests__/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var expect = require('chai').expect;
var MongoClient = require('mongodb').MongoClient;

describe('middleware', () => {
var healthInfo, db;

beforeAll(function (done) {
MongoClient.connect(
'mongodb+srv://numanzor:Nu121692.@microservice-tutorial-hq75f.mongodb.net/chronos-access', { useNewUrlParser: true }, function(err, client) {
if (err) throw new Error(err);
done();
db = client.db('chronos-access');
healthInfo = db.collection('healthinfos');
}
);
});

test('should have records in the "healthinfos" collection', done => {
healthInfo.countDocuments(function (err, num) {
expect(err).to.not.exist;
expect(num).to.be.above(0);
done();
});
});

test('should have the right string and date-time fields', done => {
healthInfo.find().toArray(function (err, data) {
expect(err).to.not.exist;
expect(data).to.be.an('Array');
var dataPoint = data[0];
expect(dataPoint.currentMicroservice).to.be.a('string').and.not.eql('');
expect(dataPoint.targetedEndpoint).to.be.a('string').and.not.eql('');
expect(dataPoint.reqType).to.be.a('string').and.not.eql('');
expect(dataPoint.timeSent).to.be.a('date').and.not.eql('');
done();
});
});

afterAll(function () {
db.close();
});
});
Binary file added app/assets/icon2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions app/charts/latency-chart.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { useContext } from 'react';
import { Line } from 'react-chartjs-2';
import HealthContext from '../context/DetailsContext';

const LatencyChart = (props) => {
const xAxis = [];
const yAxis = [];
const healthData = useContext(HealthContext).detailData;
for (let i = 0; i < healthData.length; i++) {
const element = healthData[i];
if (element.currentmicroservice === props.service || element.currentMicroservice === props.service) {
xAxis.push(i);
yAxis.push(element.latency);
}
}
const chartData = {
datasets: [
{
label: `CPU latency of ${props.service}`,
data: yAxis,
backgroundColor: ['rgb(254, 255, 0)'],
},
],
options: {
xAxisID: 'TBD',
yAxisID: 'TBD',
},
labels: xAxis,
};
return (
<div>
<Line data={chartData} />
</div>
);
};

export default LatencyChart;
Loading