Socket
Socket
Sign inDemoInstall

@pager/metrics-client

Package Overview
Dependencies
23
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.0 to 4.2.0

26

lib/index.js

@@ -35,4 +35,19 @@ 'use strict';

response: {
ver: process.env.npm_package_version,
sha: process.env.VCS_REF
ver: process.env.npm_package_version ? process.env.npm_package_version : '0.0.0',
sha: process.env.VCS_REF ? process.env.VCS_REF : '0000000',
buildDate: process.env.BUILD_DATE ? process.env.BUILD_DATE : '1970-01-01T00:00:00Z',
nodeVer: process.versions.node,
npmVer: process.env.npm_config_user_agent ? process.env.npm_config_user_agent
.split(' ')
.reduce((result, value) => {
if (result === '0.0.0') {
const parsed = /npm\/([0-9]+(\.[0-9]+)*)/i.exec(value);
if (parsed) {
result = parsed[1];
}
}
return result;
}, '0.0.0') : '0.0.0'
}

@@ -103,3 +118,3 @@ }

method: request.method,
path: request.path,
path: request.route.fingerprint,
/* $lab:coverage:off$ */

@@ -152,3 +167,6 @@ statusCode: request.response ? request.response.statusCode : 0

ver: Joi.string().regex(/[0-9]+(\.[0-9]+)*/).default('0.0.0'),
sha: Joi.string().alphanum().length(7).default('plzSet1')
nodeVer: Joi.string().regex(/[0-9]+(\.[0-9]+)*/).default('0.0.0'),
npmVer: Joi.string().regex(/[0-9]+(\.[0-9]+)*/).default('0.0.0'),
buildDate: Joi.date().iso().default('1970-01-01T00:00:00Z'),
sha: Joi.string().alphanum().length(7).default('0000000')
}),

@@ -155,0 +173,0 @@ modify: true,

33

lib/metrics/request.js

@@ -26,3 +26,3 @@ 'use strict';

help: 'Request duration in milliseconds.',
labelNames: ['method', 'path', 'cardinality', 'status'],
labelNames: ['method', 'path', 'status'],
registers: this.registries

@@ -34,3 +34,3 @@ }));

help: 'Request duration buckets in milliseconds. Bucket size set to 500 and 2000 ms to enable apdex calculations with a T of 300ms',
labelNames: ['method', 'path', 'cardinality', 'status'],
labelNames: ['method', 'path', 'status'],
buckets: [100, 500, 2000],

@@ -43,8 +43,7 @@ registers: this.registries

const parsed = internals.parsePath(path);
const parsedPath = internals.parsePath(path);
const labels = {
method: method.toLowerCase(),
path: parsed.path,
status: statusCode,
cardinality: parsed.cardinality
path: parsedPath,
status: statusCode
};

@@ -73,18 +72,10 @@ const duration = internals.ms(startTime);

const parsed = {
path,
cardinality: internals.CARDINALITY_MANY
};
return path
.toLowerCase()
.split('/')
.map((segment) => {
if (!path.endsWith('/')) {
if (!path.includes('.')) {
parsed.path = path.substr(0, path.lastIndexOf('/') + 1);
}
parsed.cardinality = internals.CARDINALITY_ONE;
}
return parsed;
return segment === '?' ? '{?}' : segment;
})
.join('/');
};
{
"name": "@pager/metrics-client",
"version": "4.1.0",
"version": "4.2.0",
"description": "Hapi-centric Prometheus Plugin and optional endpoint",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

"joi": "14.x.x",
"prom-client": "11.3.x"
"prom-client": "11.5.x"
},

@@ -29,0 +29,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc