-
Notifications
You must be signed in to change notification settings - Fork 176
Description
Expected Behavior
Hi,
The typescript implementation of addDimensions diverge from python implementation where in former, you are creating a new dimensionSet this.#dimensionsStore.addDimensionSet(newDimensions); while in python, it appends to dimensions to existing set.
Also, the method documentation does not specify this clearly. Ideally as per name suggests, it should append new dimensions to existing dimensionSet.
Current Behavior
AddDimensions function is creating a new dimension set for given set of metrics instead of appending to existing set.
Code snippet
public addDimensions(dimensions: Dimensions): void {
const newDimensions = this.#sanitizeDimensions(dimensions);
const currentCount = this.#dimensionsStore.getDimensionCount();
const newSetCount = Object.keys(newDimensions).length;
if (currentCount + newSetCount >= MAX_DIMENSION_COUNT) {
throw new RangeError(
`The number of metric dimensions must be lower than ${MAX_DIMENSION_COUNT}`
);
}
this.#dimensionsStore.addDimensionSet(newDimensions);
}
Steps to Reproduce
Call addDimensions twice with different set of key value pairs before publishing metrics. It would result in two different dimension sets.
Possible Solution
Loop over given dimensions and add each pair to existing set.
newDimensions.forEach((k,v) -> this.#dimensionsStore.addDimension(name, value);)
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
22.x
Packaging format used
npm
Execution logs
Metadata
Metadata
Assignees
Labels
Type
Projects
Status