express-prom-bundle
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "express-prom-bundle", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "express middleware with popular prometheus metrics in one bundle", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -13,3 +13,3 @@ [![build status](https://api.travis-ci.org/disjunction/express-prom-bundle.png)](https://travis-ci.org/disjunction/express-prom-bundle) | ||
* `nodejs_memory_heap_total_bytes` and `nodejs_memory_heap_used_bytes` | ||
* `http_request_total`: count of http requests labeled with status_code | ||
* `http_request_seconds`: http latency histogram labeled with status_code | ||
@@ -33,2 +33,3 @@ ## Install | ||
* **prefix**: prefix added to every metric name | ||
* **whitelist**, **blacklist**: array of strings or regexp. These which metrics to include/exclude | ||
@@ -45,3 +46,4 @@ ## Example | ||
app.use(promBundle({ | ||
prefix: "demo_app:something" | ||
prefix: "demo_app:something", | ||
blacklist: ["up"] | ||
})); | ||
@@ -48,0 +50,0 @@ |
@@ -8,6 +8,9 @@ "use strict"; | ||
function filterArrayByRegExps(array, regexps) { | ||
let compiled = regexps.map(regexp => new RegExp(regexp)); | ||
return array.filter(element => { | ||
for (let regexp of compiled) { | ||
if (element.match(regexp)) { | ||
for (let regexp of regexps) { | ||
if (regexp instanceof RegExp) { | ||
if (element.match(regexp)) { | ||
return true; | ||
} | ||
} else if (element == regexp) { | ||
return true; | ||
@@ -60,5 +63,5 @@ } | ||
), | ||
"http_request_duration": () => { | ||
"http_request_seconds": () => { | ||
const metric = factory.newHistogram( | ||
"http_request_duration", | ||
"http_request_seconds", | ||
"number of http responses labeled with status code", | ||
@@ -90,5 +93,5 @@ { | ||
if (metrics["http_request_duration"]) { | ||
if (metrics["http_request_seconds"]) { | ||
labels = {"status_code": 0}; | ||
timer = metrics["http_request_duration"].startTimer(labels); | ||
timer = metrics["http_request_seconds"].startTimer(labels); | ||
} | ||
@@ -95,0 +98,0 @@ |
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
7073
148
51