New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aws-embedded-metrics

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-embedded-metrics - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

30

lib/logger/MetricsContext.js

@@ -101,26 +101,14 @@ "use strict";

MetricsContext.validateDimensionSet(incomingDimensionSet);
if (this.dimensions.length === 0) {
this.dimensions.push(incomingDimensionSet);
return;
}
for (let i = 0; i < this.dimensions.length; i++) {
const existingDimensionSet = this.dimensions[i];
// check for duplicate dimensions when putting
// this is an O(n^2) operation, but since we never expect to have more than
// 10 dimensions, this is acceptable for almost all cases.
// This makes re-using loggers much easier.
// Duplicate dimensions sets are removed before being added to the end of the collection.
// This ensures the latest dimension key-value is used as a target member on the root EMF node.
// This operation is O(n^2), but acceptable given sets are capped at 10 dimensions
const incomingDimensionSetKeys = Object.keys(incomingDimensionSet);
this.dimensions = this.dimensions.filter(existingDimensionSet => {
const existingDimensionSetKeys = Object.keys(existingDimensionSet);
const incomingDimensionSetKeys = Object.keys(incomingDimensionSet);
if (existingDimensionSetKeys.length !== incomingDimensionSetKeys.length) {
this.dimensions.push(incomingDimensionSet);
return;
return true;
}
for (let j = 0; j < existingDimensionSetKeys.length; j++) {
if (!incomingDimensionSetKeys.includes(existingDimensionSetKeys[j])) {
// we're done now because we know that the dimensions keys are not identical
this.dimensions.push(incomingDimensionSet);
return;
}
}
}
return !existingDimensionSetKeys.every(existingDimensionSetKey => incomingDimensionSetKeys.includes(existingDimensionSetKey));
});
this.dimensions.push(incomingDimensionSet);
}

@@ -127,0 +115,0 @@ /**

{
"name": "aws-embedded-metrics",
"version": "3.0.0",
"version": "3.0.1",
"description": "AWS Embedded Metrics Client Library",

@@ -5,0 +5,0 @@ "main": "lib/index.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