From bbd62e34d6f3d5ae85606f0a6de028e440bab0a2 Mon Sep 17 00:00:00 2001 From: Jonathan Creamer Date: Tue, 11 Jul 2017 04:41:40 -0500 Subject: [PATCH] Upgrade prom-client... again (#9) * Update package.json * Update call to Histogram * Update package.json * Update index.js * Update index.js --- package.json | 4 ++-- src/index.js | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 9080544..8477f70 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.js b/src/index.js index 9dd47c6..e640ecc 100644 --- a/src/index.js +++ b/src/index.js @@ -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; } };