Skip to content

shows whether the last X runs of a service failed

Notifications You must be signed in to change notification settings

dcolens/service-health

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

Express middleware that checks if the last consecutiveFailures runs of a route failed, it helps keep track of the health of a service without generating extra load.

A route failure is defined as response status code being above failThreshold.

If there are consecutiveFailures consecutive failures, the health is considered bad.

#Example:

var express = require('express');
var app = express();

var health = require('service-health.js');

health.set({
    consecutiveFailures: 10, 
    failThreshold: 500
});

app.use(health.middleware);

app.get('/health', function(req, res) {
    res.sendStatus(health.status());
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

In the above example, the /health endpoint will return 500 if the last 10 runs returned a status code >= 500 and 204 otherwise.

About

shows whether the last X runs of a service failed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published