Socket
Socket
Sign inDemoInstall

express-prom-bundle

Package Overview
Dependencies
Maintainers
1
Versions
53
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 4.2.1 to 4.3.0

4

package.json
{
"name": "express-prom-bundle",
"version": "4.2.1",
"version": "4.3.0",
"description": "express middleware with popular prometheus metrics in one bundle",

@@ -21,3 +21,3 @@ "main": "src/index.js",

"on-finished": "^2.3.0",
"prom-client": "~11.1.1",
"prom-client": "~11.2.1",
"url-value-parser": "^2.0.0"

@@ -24,0 +24,0 @@ },

@@ -12,3 +12,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)

* `up`: normally is just 1
* `http_request_duration_seconds`: http latency histogram labeled with `status_code`, `method` and `path`
* `http_request_duration_seconds`: http latency histogram/summary labeled with `status_code`, `method` and `path`

@@ -66,5 +66,10 @@ ## Install

Metric type:
* **metricType**: two metric types are supported for `http_request_duration_seconds` metric: [histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) and [summary](https://prometheus.io/docs/concepts/metric_types/#summary), default: **histogram**
Other options:
* **buckets**: buckets used for `http_request_duration_seconds` histogram
* **percentiles**: percentiles used for `http_request_duration_seconds` summary
* **autoregister**: if `/metrics` endpoint should be registered. (Default: **true**)

@@ -71,0 +76,0 @@ * **promClient**: options for promClient startup, e.g. **collectDefaultMetrics**. This option was added

@@ -65,2 +65,3 @@ 'use strict';

formatStatusCode: main.normalizeStatusCode,
metricType: 'histogram',
promClient: {}

@@ -110,9 +111,20 @@ },

}
const metric = new promClient.Histogram({
name: httpMetricName,
help: 'duration histogram of http responses labeled with: ' + labels.join(', '),
labelNames: labels,
buckets: opts.buckets || [0.003, 0.03, 0.1, 0.3, 1.5, 10]
});
return metric;
if (opts.metricType === 'summary') {
return new promClient.Summary({
name: httpMetricName,
help: 'duration summary of http responses labeled with: ' + labels.join(', '),
labelNames: labels,
percentiles: opts.percentiles || [0.5, 0.75, 0.95, 0.98, 0.99, 0.999]
});
} else if (opts.metricType === 'histogram' || !opts.metricType) {
return new promClient.Histogram({
name: httpMetricName,
help: 'duration histogram of http responses labeled with: ' + labels.join(', '),
labelNames: labels,
buckets: opts.buckets || [0.003, 0.03, 0.1, 0.3, 1.5, 10]
});
} else {
throw new Error('metricType option must be histogram or summary');
}
}

@@ -119,0 +131,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