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

prom-client

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prom-client - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

17

lib/counter.js

@@ -10,2 +10,3 @@ /**

var createValue = require('./util').incValue;
var hashObject = require('./util').hashObject;
var validateLabels = require('./validation').validateLabel;

@@ -57,2 +58,3 @@ var validateMetricName = require('./validation').validateMetricName;

}
return inc.call(this, labels)(value);

@@ -71,10 +73,11 @@ };

Counter.prototype.labels = function() {
var labels = getLabels(this.labelNames, arguments);
var labels = getLabels(this.labelNames, arguments) || {};
var hash = hashObject(labels);
validateLabels(this.labelNames, labels);
return {
inc: inc.call(this, labels)
inc: inc.call(this, labels, hash)
};
};
var inc = function(labels) {
var inc = function(labels, hash) {
var that = this;

@@ -88,6 +91,6 @@ return function(value) {

}
labels = labels || {};
validateLabels(that.labelNames, labels);
that.hashMap = createValue(that.hashMap, value || 1, labels);
that.hashMap = createValue(that.hashMap, value || 1, labels, hash);
};

@@ -94,0 +97,0 @@ };

@@ -12,4 +12,3 @@ 'use strict';

exports.incValue = function createValue(hashMap, value, labels) {
var hash = hashObject(labels);
exports.incValue = function createValue(hashMap, value, labels, hash) {
if(hashMap[hash]){

@@ -16,0 +15,0 @@ hashMap[hash].value += value || 1;

{
"name": "prom-client",
"version": "3.4.2",
"version": "3.4.3",
"description": "Client for prometheus",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -21,9 +21,2 @@ 'use strict';

it('should not allow non numbers', function() {
var fn = function() {
instance.inc('asd');
};
expect(fn).to.throw(Error);
});
it('should not be possible to decrease a counter', function() {

@@ -30,0 +23,0 @@ var fn = function() {

Sorry, the diff of this file is not supported yet

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