an extraction of common npm microservice monitoring functions

Usage no npm install needed!

<script type="module">
  import ceejbotRestifyMonitor from 'https://cdn.skypack.dev/@ceejbot/restify-monitor';



Add monitoring endpoints to an npm service. One stop shop.

Travis Coverage

This module has been published to our npm-enterprise registry as @npm/restify-monitor


To install: npm install --save @npm/restify-monitor.

var restify = require('restify');
var monitor = require('@npm/restify-monitor');

var server = restify.createServer();
    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