A simple Node.js server exposing health and Prometheus metrics endpoints.
This project, node-metrics, provides a setup to run a Node.js server with two main endpoints:
/health: To check the health of the server, which responds withOK./metrics: To fetch Prometheus-style metrics suitable for monitoring.
The metrics include default Node.js metrics and can easily be scraped by Prometheus or similar monitoring tools.
You can pull the Docker image of this repository from GitHub Container Registry.
-
Latest version:
docker pull ghcr.io/minuchi/node-metrics:latest
-
Specific version (e.g., v1.0.0):
docker pull ghcr.io/minuchi/node-metrics:v1.0.0
To run the Docker container:
docker run -p 3000:3000 ghcr.io/minuchi/node-metrics:latest-
Clone the Repository:
git clone https://github.com/minuchi/node-metrics.git cd node-metrics -
Install Dependencies:
yarn
-
Build the Project:
yarn build
By default, the server runs on port 3000. You can configure it using the PORT environment variable.
-
Production:
yarn start
OR to specify a port:
PORT=4000 yarn start
This will run the server on port
4000. -
Development:
yarn dev
- Health:
http://localhost:3000/health(or the port you specified) - Metrics:
http://localhost:3000/metrics
-
Prettier: To format your TypeScript files, run:
yarn format