Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-prom-bundle

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-prom-bundle - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc