Giter Site home page Giter Site logo

chronos's Introduction

Chronos logo

Chronos

Microservice communication, health, and Docker container visualizer. Comes with a middleware and an Electron app.

Features

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

NEW FEATURE FOR 3.0+ - Logging Docker Container Stats

IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below.

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: /var/run/docker.sock

For example, you can type the following when starting up a container: docker run -v /var/run/docker.sock:/var/run/docker.sock [your-image-tag]

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:

volumes:
  - "/var/run/docker.sock:/var/run/docker.sock"

*Note: This module leverages the features of systeminformation.

Installation

Chronos consists of a Node module available through the npm registry and a lightweight Electron desktop application.

Node module

To begin, install the Chronos node module within each microservice of your application using the npm installcommand:

npm install chronos-microservice-debugger4

Once installed, write the following two lines at the top of each microservice's server file:

const cmd = require('chronos-microservice-debugger4');
cmd.propagate();

Then add a route handler for all incoming requests:

app.use('/', 
  cmd.microCom(
    'microserviceName', 
    'databaseType',
    'databaseURL',
    'wantMicroHealth', 
    'queryFrequency',
    'isDockerized'
  )
)

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.

cmd.microCom takes six parameters. You can enter the arguments as individual strings or as an array.

The parameters are:

  • [1] microserviceName: To identify the microservice (i.e. "payments").
    • Make sure this name matches your container name. More details more below (param #6).
    • Your input name for the microservice will be turned to an all-lowercase string.
  • [2] databaseType: Enter either "mongo" or "sql".
  • [3] databaseURL: Enter the URL of your database.
  • [4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
    • 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.
  • [5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
    • "s" : every second
    • "m" : every minute (default)
    • "h" : every hour
    • "d" : once per day
    • "w" : once per week
  • [6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
    • 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.
    • Don't forget to bind mount to Docker socket. See NEW FEATURE section above.

String parameter example:

app.use('/', cmd.microCom('payments', 'mongo', 'mongodb+srv://user:[email protected]/','yes','m','no'))

Array parameter example:

let values = [
  'payments',
  'mongo',
  'mongodb+srv://user:[email protected]/',
  'no',
  'h',
  'yes'
]

app.use('/', cmd.microCom(values)

Microservice Test Suite

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.

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.

Refer to the README of that branch for more details.

Electron desktop application

After installing the node module in each microservice, download the Electron desktop application from the public Chronos repo.

Inside the downloaded directory, install all dependencies using the npm install command followed by the npm start command to start the Electron desktop application.

Contributing

Chronos hopes to inspire an active community of both users and developers. For questions, comments, or contributions, please submit a pull request.

People

Tim Atapagra, Brian Bui, Mohtasim Chowdhury, Ousman Diallo, Michelle Herrera, Alan Lee, Duane McFarlane, Ben Mizel, Alon Ofengart, Jenae Pennie, Chris Romano, Brianna Sookhoo, Natalie Umanzor

License

MIT

chronos's People

Contributors

mesherrera avatar umius-brian avatar jenaepen avatar dialloousman avatar ajlee12 avatar alon25 avatar robicano22 avatar duane11003 avatar nmczormick avatar tim-atapagra avatar ben-mizel avatar mohtasim317 avatar briannasookhoo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.