express-prometheus-middleware
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.5.1"></a> | ||
## [0.5.1](https://github.com/joao-fontenele/express-prometheus-middleware/compare/v0.5.0...v0.5.1) (2018-08-23) | ||
### Bug Fixes | ||
* route was wrong when mounting from another route ([c3bb869](https://github.com/joao-fontenele/express-prometheus-middleware/commit/c3bb869)) | ||
<a name="0.5.0"></a> | ||
@@ -7,0 +17,0 @@ # [0.5.0](https://github.com/joao-fontenele/express-prometheus-middleware/compare/v0.4.0...v0.5.0) (2018-08-23) |
{ | ||
"name": "express-prometheus-middleware", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "RED/USE metrics for express applications", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -35,9 +35,9 @@ const express = require('express'); | ||
const redMiddleware = ResponseTime((req, res, time) => { | ||
const { path, method } = req; | ||
const { originalUrl, method } = req; | ||
// will replace ids from the route with `#val` placeholder this serves to | ||
// measure the same routes, e.g., /image/id1, and /image/id2, will be | ||
// treated as the same route | ||
const route = normalizePath(originalUrl); | ||
if (path !== metricsPath) { | ||
// will replace ids from the route with `#val` placeholder this serves to | ||
// measure the same routes, e.g., /image/id1, and /image/id2, will be | ||
// treated as the same route | ||
const route = normalizePath(path); | ||
if (route !== metricsPath) { | ||
const status = normalizeStatusCode(res.statusCode); | ||
@@ -44,0 +44,0 @@ |
@@ -0,1 +1,2 @@ | ||
const url = require('url'); | ||
const UrlValueParser = require('url-value-parser'); | ||
@@ -22,4 +23,5 @@ | ||
*/ | ||
function normalizePath (path, placeholder = '#val') { | ||
return urlParser.replacePathValues(path, placeholder); | ||
function normalizePath (originalUrl, placeholder = '#val') { | ||
const { pathname } = url.parse(originalUrl); | ||
return urlParser.replacePathValues(pathname, placeholder); | ||
} | ||
@@ -26,0 +28,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
96756
181