express-prom-bundle
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "express-prom-bundle", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "express middleware with popular prometheus metrics in one bundle", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -54,2 +54,3 @@ [![build status](https://travis-ci.org/jochen-schweizer/express-prom-bundle.png)](https://travis-ci.org/jochen-schweizer/express-prom-bundle) [![Coverage Status](https://coveralls.io/repos/github/jochen-schweizer/express-prom-bundle/badge.svg?branch=master)](https://coveralls.io/github/jochen-schweizer/express-prom-bundle?branch=master) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/express-prom-bundle.png)](http://badge.fury.io/js/express-prom-bundle) | ||
* **excludeRoutes**: (deprecated) array of strings or regexp specifying which routes should be skipped for `http_request_duration_seconds` metric. It uses `req.originalUrl` as subject when checking. You want normally use express or meddleware features instead of this options. | ||
### More details on includePath option | ||
@@ -103,6 +104,8 @@ | ||
// register metrics collection for all routes except those starting with /foo | ||
// register metrics collection for all routes | ||
// ... except those starting with /foo | ||
app.use("/((?!foo))*", promBundle({includePath: true})); | ||
// this call will NOT appear in metrics, because express will skip the metrics middleware | ||
// this call will NOT appear in metrics, | ||
// because express will skip the metrics middleware | ||
app.get("/foo", (req, res) => res.send("bar")); | ||
@@ -109,0 +112,0 @@ |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const normalizePath = require('./normalizePath'); | ||
const normalizeStatusCode = require('./normalizeStatusCode'); | ||
@@ -120,3 +121,8 @@ function matchVsRegExps(element, regexps) { | ||
onFinished(res, () => { | ||
labels.status_code = res.statusCode; | ||
if (opts.normalizeStatusCode) { | ||
labels.status_code = main.normalizeStatusCode(res, opts); | ||
} else { | ||
labels.status_code = res.statusCode; | ||
} | ||
if (opts.includeMethod) { | ||
@@ -144,2 +150,3 @@ labels.method = req.method; | ||
main.normalizePath = normalizePath; | ||
main.normalizeStatusCode = normalizeStatusCode; | ||
module.exports = main; |
@@ -27,2 +27,1 @@ 'use strict'; | ||
}; | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14062
8
159
181