Upgrade prom-client... again (#9)

* Update package.json

* Update call to Histogram

* Update package.json

* Update index.js

* Update index.js
This commit is contained in:
Jonathan Creamer
2017-07-11 04:41:40 -05:00
committed by The Experimentalist
parent b8ba87009e
commit bbd62e34d6
2 changed files with 12 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "express-prom-bundle",
"version": "3.0.0",
"version": "3.0.1",
"description": "express middleware with popular prometheus metrics in one bundle",
"main": "src/index.js",
"keywords": [
@@ -17,7 +17,7 @@
"license": "MIT",
"dependencies": {
"on-finished": "^2.3.0",
"prom-client": "^9.0.0",
"prom-client": "^10.0.0",
"url-value-parser": "^1.0.0"
},
"devDependencies": {

View File

@@ -69,10 +69,10 @@ function main(opts) {
const httpMtricName = opts.httpDurationMetricName || 'http_request_duration_seconds';
const metricTemplates = {
'up': () => new promClient.Gauge(
'up',
'1 = up, 0 = not up'
),
'up': () => new promClient.Gauge({
name: 'up',
help: '1 = up, 0 = not up'
}),
'http_request_duration_seconds': () => {
const labels = ['status_code'];
if (opts.includeMethod) {
@@ -81,14 +81,12 @@ function main(opts) {
if (opts.includePath) {
labels.push('path');
}
const metric = new promClient.Histogram(
httpMtricName,
'duration histogram of http responses labeled with: ' + labels.join(', '),
labels,
{
buckets: opts.buckets || [0.003, 0.03, 0.1, 0.3, 1.5, 10]
}
);
const metric = new promClient.Histogram({
name: httpMtricName,
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;
}
};