cat-a-logs 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/client/index.ts +7 -5
  2. package/package.json +1 -1
package/client/index.ts CHANGED
@@ -151,14 +151,16 @@ async function catalog(
151
151
  //usable instance of the validation JSON
152
152
  const validateEmf = ajv.compile(emfSchema);
153
153
  //sort customerDimensions key values in alphabetical order. We will use this to keep the keys in our cache consistant. Since the order of the dimensions do not change where the metrics are stored
154
- const sortedDimensions: { [key: string]: string } = {};
154
+ // const sortedDimensions: { [key: string]: string } = {}; // Doesn't need to be an object. Made it a string
155
+ let sortedDimensions: string = '';
156
+ const sortedCustomerDimensions: Array<string> = Object.keys(CustomerDefinedDimension).sort();
155
157
  for (
156
158
  let i = 0;
157
- i < Object.keys(CustomerDefinedDimension).sort().length;
159
+ i < sortedCustomerDimensions.length;
158
160
  i++
159
161
  ) {
160
- sortedDimensions[Object.keys(CustomerDefinedDimension).sort()[i]] =
161
- CustomerDefinedDimension[Object.keys(CustomerDefinedDimension).sort()[i]];
162
+ sortedDimensions +=
163
+ sortedCustomerDimensions[i];
162
164
  }
163
165
  //Check if Object with Namespace and Dimensions already exists in cache
164
166
  let check = cache[`${metricNamespace}${sortedDimensions}`];
@@ -183,7 +185,7 @@ async function catalog(
183
185
  CloudWatchMetrics: [
184
186
  {
185
187
  Namespace: metricNamespace,
186
- Dimensions: [Object.keys(sortedDimensions)],
188
+ Dimensions: sortedCustomerDimensions,
187
189
  Metrics: [
188
190
  {
189
191
  Name: metricName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-a-logs",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Create & send structured logs to AWS Cloudwatch logs",
5
5
  "main": "index.js",
6
6
  "exports": {