Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-prometheus-middleware

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-prometheus-middleware - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

10

CHANGELOG.md

@@ -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)

2

package.json
{
"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 @@

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