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 2.0.6 to 3.0.0

lib/exceptions/DimensionSetExceededError.d.ts

2

lib/Constants.d.ts
export declare enum Constants {
MAX_DIMENSIONS = 9,
MAX_DIMENSION_SET_SIZE = 30,
DEFAULT_NAMESPACE = "aws-embedded-metrics",

@@ -4,0 +4,0 @@ MAX_METRICS_PER_EVENT = 100,

@@ -19,3 +19,3 @@ "use strict";

(function (Constants) {
Constants[Constants["MAX_DIMENSIONS"] = 9] = "MAX_DIMENSIONS";
Constants[Constants["MAX_DIMENSION_SET_SIZE"] = 30] = "MAX_DIMENSION_SET_SIZE";
Constants["DEFAULT_NAMESPACE"] = "aws-embedded-metrics";

@@ -22,0 +22,0 @@ Constants[Constants["MAX_METRICS_PER_EVENT"] = 100] = "MAX_METRICS_PER_EVENT";

@@ -43,2 +43,8 @@ import { MetricValues } from './MetricValues';

/**
* Validates dimension set length is not more than Constants.MAX_DIMENSION_SET_SIZE
*
* @param dimensionSet
*/
static validateDimensionSet(dimensionSet: Record<string, string>): void;
/**
* Adds a new set of dimensions. Any time a new dimensions set

@@ -45,0 +51,0 @@ * is added, the set is first prepended by the default dimensions.

@@ -20,2 +20,4 @@ "use strict";

const MetricValues_1 = require("./MetricValues");
const Constants_1 = require("../Constants");
const DimensionSetExceededError_1 = require("../exceptions/DimensionSetExceededError");
class MetricsContext {

@@ -84,2 +86,11 @@ /**

/**
* Validates dimension set length is not more than Constants.MAX_DIMENSION_SET_SIZE
*
* @param dimensionSet
*/
static validateDimensionSet(dimensionSet) {
if (Object.keys(dimensionSet).length > Constants_1.Constants.MAX_DIMENSION_SET_SIZE)
throw new DimensionSetExceededError_1.DimensionSetExceededError(`Maximum number of dimensions per dimension set allowed are ${Constants_1.Constants.MAX_DIMENSION_SET_SIZE}`);
}
/**
* Adds a new set of dimensions. Any time a new dimensions set

@@ -91,2 +102,3 @@ * is added, the set is first prepended by the default dimensions.

putDimensions(incomingDimensionSet) {
MetricsContext.validateDimensionSet(incomingDimensionSet);
if (this.dimensions.length === 0) {

@@ -124,2 +136,3 @@ this.dimensions.push(incomingDimensionSet);

this.shouldUseDefaultDimensions = false;
dimensionSets.forEach(dimensionSet => MetricsContext.validateDimensionSet(dimensionSet));
this.dimensions = dimensionSets;

@@ -126,0 +139,0 @@ }

@@ -19,2 +19,3 @@ "use strict";

const Constants_1 = require("../Constants");
const DimensionSetExceededError_1 = require("../exceptions/DimensionSetExceededError");
/**

@@ -38,3 +39,8 @@ * Serializes the provided context to the CWL Structured

// representation for sink-specific validations
const keys = Object.keys(d).slice(0, Constants_1.Constants.MAX_DIMENSIONS);
const keys = Object.keys(d);
if (keys.length > Constants_1.Constants.MAX_DIMENSION_SET_SIZE) {
const errMsg = `Maximum number of dimensions allowed are ${Constants_1.Constants.MAX_DIMENSION_SET_SIZE}.` +
`Account for default dimensions if not using set_dimensions.`;
throw new DimensionSetExceededError_1.DimensionSetExceededError(errMsg);
}
dimensionKeys.push(keys);

@@ -41,0 +47,0 @@ dimensionProperties = Object.assign(Object.assign({}, dimensionProperties), d);

{
"name": "aws-embedded-metrics",
"version": "2.0.6",
"version": "3.0.0",
"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