Jacwutang / Sauce

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instructions

Prerequisites:

  1. NodeJS 10.x
  2. Python 3.x
  3. Twisted module pip install Twisted

Setup

  1. git clone {this repository}
  2. Go to root level of the cloned repo and npm install, and start the node server with npm run start
  3. cd into frontend folder and npm install, and start webpack server with npm run start-dev

application

Features

1) GUI for starting/stopping health check

  • Implemented using websockets, Node server pushes data at a one second interval at a lower overhead cost than continous http polling
const pollingHelper = () => {
  request("http://127.0.0.1:12345", (error, response, body) => {
    //Emit statusCode, and timestamp to front-end
    socket.emit("dataPoint", {
      timestamp: Date.now(),
      status: response.statusCode
    });
  });
};
  • Used a charting library to graph / table continous data

demo-one

2) Rolling data for the past 5 minutes

demo-two

  • Since data is updated approximately once per second, I used this approximation to store at most 300 ( 5 (minutes) * 60 seconds == 300 seconds) data points.
insertIndex =  counter % 300
counter = (counter + 1) % 300

Once all 300 slots in the array are filled, the next entry will be at index 0, and then 1,2,3,etc... Such that the oldest points get overwritten.


3) Testing

  • Still in progress. Ran into some issues with environment configuration, and deployment.
  • After cloning, cd frontend and npm run test (babel issue currently)

About


Languages

Language:JavaScript 71.7%Language:HTML 17.5%Language:CSS 6.2%Language:Python 4.6%