@ceejbot/restify-monitor
v0.1.4
Published
an extraction of common npm microservice monitoring functions
Downloads
7
Readme
restify-monitor
Add monitoring endpoints to an npm service. One stop shop.
This module has been published to our npm-enterprise registry as @npm/restify-monitor
Usage
To install: npm install --save @npm/restify-monitor
.
var restify = require('restify');
var monitor = require('@npm/restify-monitor');
var server = restify.createServer();
monitor(server,
{
logger: bole('my-little-pony'),
metrics: myMetricsClient
});
What it does: Adds a logging after
handler to the restify server. If you provide metrics
and logger
fields in the options object, it'll decorate each request with them. Also adds GET and HEAD routes for two monitoring endpoints.
GET /_monitor/ping
: responds with 200 pong.
GET /_monitor/status
: responds with a status object containing the following data:
- name: the server name you provided to restify
- pid: process.pid
- uptime: process.uptime()
- rss: process.memoryUsage()
- git: hash of the head commit if the process is running in a git repo
- message: commit message of the head commit if the process is in a git repo
License
ISC.