express-prom-bundle
Advanced tools
Comparing version 4.2.1 to 4.3.0
{ | ||
"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 @@ }; |
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
18695
204
255
+ Addedprom-client@11.2.1(transitive)
- Removedprom-client@11.1.3(transitive)
Updatedprom-client@~11.2.1