All Projects → nishgowda → aegisnet

nishgowda / aegisnet

Licence: MIT license
Lightweight express, koa, and http middleware for efficient API endpoint monitoring

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to aegisnet

treblle-laravel
The offical Treblle package for Laravel
Stars: ✭ 43 (+230.77%)
Mutual labels:  api-service, monitoring-tool
express-error-slack
Express error handling middleware for reporting error to Slack
Stars: ✭ 14 (+7.69%)
Mutual labels:  express-middleware
elcep
Elastic Log Counter Exporter for Prometheus
Stars: ✭ 14 (+7.69%)
Mutual labels:  monitoring-tool
liuye
柳叶清单开放 API 文档
Stars: ✭ 32 (+146.15%)
Mutual labels:  api-service
gochanges
**[ARCHIVED]** website changes tracker 🔍
Stars: ✭ 12 (-7.69%)
Mutual labels:  monitoring-tool
travels-api
API for Travels Management - UFLA Comp Jr/20 anniversary event
Stars: ✭ 22 (+69.23%)
Mutual labels:  api-service
xiachufang-api
下厨房 API
Stars: ✭ 53 (+307.69%)
Mutual labels:  api-service
leek
Celery Tasks Monitoring Tool
Stars: ✭ 77 (+492.31%)
Mutual labels:  monitoring-tool
BooksApp
Book selling application with MVVM (Model, View, ViewModel), LiveData, DataBinding, Retrofit, Room Database, Navigation Component(NavGraph, BottomNav), ViewPager2 in TabLayout, SearchView, Vertical Adapter(BestSellers) and Horizontal Adapter(All Books) with ConcatAdapter for Main Screen, Firebase Auth, SearchView in Adapter, Picasso, Lottie, Ani…
Stars: ✭ 53 (+307.69%)
Mutual labels:  api-service
Aliexpress-API
An Personal API For Fetching Product Details On Aliexpress.com
Stars: ✭ 60 (+361.54%)
Mutual labels:  api-service
yametrikapy
Python library for Yandex Metrika API
Stars: ✭ 20 (+53.85%)
Mutual labels:  api-service
coronavirus-dashboard-api-R-sdk
Coronavirus (COVID-19) in the UK - API Service SDK for R
Stars: ✭ 23 (+76.92%)
Mutual labels:  api-service
express-json-validator-middleware
Express middleware for validating requests against JSON schema
Stars: ✭ 148 (+1038.46%)
Mutual labels:  express-middleware
ValueHistories.jl
Utilities to efficiently track learning curves or other optimization information
Stars: ✭ 28 (+115.38%)
Mutual labels:  monitoring-tool
remult
A CRUD framework for full stack TypeScript
Stars: ✭ 1,488 (+11346.15%)
Mutual labels:  express-middleware
instagram-monitor
Easily monitor instagram accounts without any problem.
Stars: ✭ 41 (+215.38%)
Mutual labels:  monitoring-tool
PFMonitor
PFMonitor -- for deep learning engineer's freedom
Stars: ✭ 17 (+30.77%)
Mutual labels:  monitoring-tool
kafka-consumer-lag-monitoring
Client tool that exports the consumer lag of Kafka consumer groups to Prometheus or your terminal
Stars: ✭ 45 (+246.15%)
Mutual labels:  monitoring-tool
spark-alarm
Alerting and monitoring tool for Apache Spark
Stars: ✭ 23 (+76.92%)
Mutual labels:  monitoring-tool
codetabs
Free Online Services. Github/GitLab star history. Count Lines of Code. CORS proxy server. IP GeoLocation. Convert Video to Gif. HTTP Headers. Api weather temp. Alexa ranking.
Stars: ✭ 114 (+776.92%)
Mutual labels:  api-service

Logo

Fast and light weight api and endpoint monitoring backed by Redis and carefully written for performace.

build npm GitHub

Features:

  • Url request monitoring
  • Easily integratable with Express, Koa, and standard http
  • Fast and efficient data storage based on Redis
  • Monitoring daily requests
  • Moinotring requests per hour
  • Monitoring response times
  • Custom options

The Rundown:

  • An object is made in redis that is defined as an event. An event is a collection of the route, the method, the status code, the number of requests, and date and hour (depending on what key is specified).

  • Redis stores the data per request into three separate keys:

    1. The total number of requests per event (date and hour are not included here)
    2. The total number of requests per event per day
    3. The total number of requests per event per hour of every day.
    4. The time in milliseconds each event takes per request.
  • Note: These keys are stored by default as key names: 'total', 'daily', 'hourly', and 'response-times'.

Install

    $ npm install aegis-net

Usage:

Express:

const express = require('express')
const {AegisNet}  = require('aegis-net');
const app = express();
app.use(express.json());
const aegis = new AegisNet;

app.use(aegis.express())

Koa:

const koa = require('koa');
const {AegisNet}  = require('aegis-net');
const router = require('@koa/router');
const app = new koa();
const router = new Router();

app.use(aegis.koa());

http:

const http = require('http');
const {AegisNet}  = require('aegis-net');

const server = http.createServer((req, res) => {
    // server code here
    aegis.http(req, res);
});
server.listen(3000, () => "Listening");

Adding custom options:

const express = require('express')
const {AegisNet}  = require('aegis-net');
const app = express();
app.use(express.json());
const aegis = new AegisNet;

app.use(aegis.express({port: 6379, host: 'localhost', dailyKey: "foo"}))

Retrieving the data:

app.get('/api/users',  (_, res) => {
      // note: Redis will store the data as a JSON string 
     //  so it's important you parse after you retrieve it first to work with it.
    client.get('total', (err, stats) => {
        res.status(200).send(stats);
    });
});

API:

options about type
port Redis port number number
host Redis host string
totalKey Key name for total requests, defaults to "total" string
dailyKey Key name for daily requests, defaults to "daily" string
hourlyKey Key name for hourly requests, defaults to "hourly" string
responseKey Key name for response-time key, defaults to "response-times" string

Example data:

[ { "method": "GET", "route": "/api/users", "statusCode": 200, "requests": 10 }]
[ { "method": "POST", "route": "/api/users", "statusCode": 200, "requests": 5, "date": "9/20/2020" }]
[ { "method": "GET", "route": "/api/users", "statusCode": 304, "requests": 2, "date": "9/20/2020", "hour": "12" }]

Side Notes:

  • It is very important you initialize the middleware before any of your routes or custom middleware. If you don't do this, you may find some unkown error. Further testing with it is required.
  • Any unkown request sent to the server will send the event with route of "unkown route".

Contributing:

Look at how to contribute to see how you can contribute to this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].