Add a standardized monitoring endpoint to your application. Especially useful for adding monitoring to services that do not expose an HTTP interface.
Simply initialize the monitor when your application starts up:
const Monitor =let monitor =
http://0.0.0.1:9999/_monitor/statusis now available, and will respond with a
200status and status object:
http://0.0.0.1:9999/_monitor/pingis also available and will respond with status
200and the text
Customizing Status Information
You can customize the status information returned using
- monitor.contribute(contributor): contribute additional information
to the status object returned on
contributor: a function returning the object to supplement the status object with.
When the monitor is first started, it will attempt to pull the commit hash for
the current project by performing a
git rev-parse. If you wish to supply your
own value for the
git field, set the
BUILD_HASH environment variable.
You can halt the monitor using
- monitor.stop() ⇒
Promise: halt the monitor
close: a function returning a Promise which is resolved once the monitor server has halted.