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

artedi

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artedi - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

3

CHANGES.md

@@ -6,2 +6,5 @@ # Changelog

## 1.4.1
* #15 improve the performance of hashObj()
## 1.4.0

@@ -8,0 +11,0 @@ * #14 Allow for metrics in a MetricVector to be optionally expired or reset to a

26

lib/utils.js

@@ -6,3 +6,3 @@ /*

*
* Copyright (c) 2017, Joyent, Inc.
* Copyright (c) 2018, Joyent, Inc.
*/

@@ -14,4 +14,2 @@

var mod_crypto = require('crypto');
/*

@@ -42,4 +40,6 @@ * This is a similar regex to the one used in the golang prometheus client lib.

* the metrics before they're stored. This function takes an object of labels.
* The labels are sorted alphabetically, sent through stringify, and then their
* md5 hash is calculated. This should be adequately unique for our case.
* The labels are sorted alphabetically and returned as a string with the keys
* joined together (with no separator), the values joined together (with no
* separator) and the resulting two strings (keys and values) joined together
* with a '/' separator.
*/

@@ -49,9 +49,13 @@ function hashObj(obj) {

var hash = mod_crypto.createHash('md5');
var newObj = {};
var idx;
var keys = Object.keys(obj).sort();
keys.forEach(function (key) {
newObj[key] = obj[key];
});
return (hash.update(JSON.stringify(newObj)).digest('hex'));
var keysStr = '';
var values = '';
for (idx = 0; idx < keys.length; idx++) {
keysStr += keys[idx];
values += obj[keys[idx]];
}
return (keysStr + '/' + values);
}

@@ -58,0 +62,0 @@

{
"name": "artedi",
"version": "1.4.0",
"version": "1.4.1",
"description": "a metric client library",

@@ -5,0 +5,0 @@ "main": "lib/collector.js",

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