diff --git a/.npmignore b/.npmignore index 3d0ac23..fb58e0d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,4 @@ docker-compose.yml -test +spec .travis.yml .eslintrc \ No newline at end of file diff --git a/README.md b/README.md index 9f7df3c..4539a20 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,49 @@ +[![build status](https://api.travis-ci.org/disjunction/express-prom-bundle.png)](https://travis-ci.org/disjunction/express-prom-bundle) + # express prometheus bundle -A bundle of standard metrics for an express application. +express middleware with popular prometheus metrics in one bundle. + +Internally it uses **prom-client**. See: https://github.com/siimon/prom-client Included metrics: -* **up**: normally is just 1 -* **nodejs_memory_heap_total_bytes** and **nodejs_memory_heap_used_bytes** -* **http_request_total**: count of http requests labeled with status_code \ No newline at end of file +* `up`: normally is just 1 +* `nodejs_memory_heap_total_bytes` and `nodejs_memory_heap_used_bytes` +* `http_request_total`: count of http requests labeled with status_code + +## Install + +``` +npm install express-prom-bundle +``` + +## Usage + +```javascript +const + promBundle = require("express-prom-bundle"), + middleware = promBundle({/* options */ }); +``` + +## Options + + * **prefix**: prefix added to every metric name + +## Example + +```javascript +"use strict"; + +const express = require("express"), + app = express(), + promBundle = require("."); + +app.use(promBundle({ + prefix: "demo_app:something" +})); + +app.get("/hello", (req, res) => res.send("ok")); + +app.listen(3000); +``` \ No newline at end of file diff --git a/example.js b/example.js deleted file mode 100644 index e6a7252..0000000 --- a/example.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const express = require("express"), - app = express(), - promBundle = require("."); - -app.use(promBundle({ - prefix: "demo_app:something" -})); - -app.get("/hello", (req, res) => res.send("ok")); - -app.listen(3000); \ No newline at end of file diff --git a/package.json b/package.json index 91b9488..be54d4b 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,12 @@ "version": "1.0.0", "description": "express middleware with popular prometheus metrics in one bundle", "main": "src/index.js", - "directories": { - "test": "test" - }, + "keywords": [ + "prometheus", + "metrics", + "express", + "bundle" + ], "scripts": { "test": "node_modules/jasme/run.js" },