From 37495e3e4a90dc9c5abbf74e7d58152a9af10daf Mon Sep 17 00:00:00 2001 From: ItsSudip Date: Sun, 8 Oct 2023 18:44:07 +0530 Subject: [PATCH 1/5] fix: create instance of transformedObj --- src/controllers/eventTest.ts | 2 +- src/services/eventTest/eventTester.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/eventTest.ts b/src/controllers/eventTest.ts index db6fc8cb6f7..8888b638075 100644 --- a/src/controllers/eventTest.ts +++ b/src/controllers/eventTest.ts @@ -19,7 +19,7 @@ export default class EventTestController { }; ctx.status = 400; } - ctx.set('apiVersion', this.API_VERSION); + ctx.set('apiVersion', EventTestController.API_VERSION); } public static status(ctx: Context) { diff --git a/src/services/eventTest/eventTester.ts b/src/services/eventTest/eventTester.ts index d4f30fff78f..a3755d3e803 100644 --- a/src/services/eventTest/eventTester.ts +++ b/src/services/eventTest/eventTester.ts @@ -11,7 +11,7 @@ export default class EventTesterService { function capitalize(s) { return s === 'id' ? s.toUpperCase() : s.charAt(0).toUpperCase() + s.slice(1); } - let transformedObj: FixMe; + const transformedObj: FixMe = {}; const { destinationDefinition } = dest; Object.keys(dest).forEach((key) => { transformedObj[capitalize(key)] = dest[key]; @@ -54,7 +54,7 @@ export default class EventTesterService { libraries, }; - let response: FixMe; + let response: FixMe = {}; let errorFound = false; if (stage.user_transform) { From 1ba7d2225e3ff2a0f499e4c52b6f9df73dea9a85 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 9 Oct 2023 10:22:15 +0000 Subject: [PATCH 2/5] chore(release): 1.44.2 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a92a073191d..b7341a6623c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.44.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.44.1...v1.44.2) (2023-10-09) + + +### Bug Fixes + +* create instance of transformedObj ([37495e3](https://github.com/rudderlabs/rudder-transformer/commit/37495e3e4a90dc9c5abbf74e7d58152a9af10daf)) + ### [1.44.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.44.0...v1.44.1) (2023-10-06) diff --git a/package-lock.json b/package-lock.json index f39c2db7b44..e88cdfe9f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.44.1", + "version": "1.44.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.44.1", + "version": "1.44.2", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "^0.7.24", diff --git a/package.json b/package.json index 43b4abbb86b..88d99217b1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.44.1", + "version": "1.44.2", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { From fbfd697654702449ee46b07a92cc36f505817817 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Mon, 9 Oct 2023 20:34:52 +0530 Subject: [PATCH 3/5] add stats for braze batch packing sizes --- src/v0/destinations/braze/util.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/v0/destinations/braze/util.js b/src/v0/destinations/braze/util.js index 0793ca5891b..63430cd19cd 100644 --- a/src/v0/destinations/braze/util.js +++ b/src/v0/destinations/braze/util.js @@ -416,6 +416,17 @@ const processBatch = (transformedEvents) => { const attributes = attributeArrayChunks[i]; const events = eventsArrayChunks[i]; const purchases = purchaseArrayChunks[i]; + + stats.gauge('braze_batch_attributes_pack_size', attributes.length, { + destination_id: destination.ID, + }); + stats.gauge('braze_batch_events_pack_size', events.length, { + destination_id: destination.ID, + }); + stats.gauge('braze_batch_purchase_pack_size', purchases.length, { + destination_id: destination.ID, + }); + const response = defaultRequestConfig(); response.endpoint = endpoint; response.body.JSON = removeUndefinedAndNullValues({ From 917d1fabfea37bd75cade990f41e09f810421e45 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Tue, 10 Oct 2023 10:13:17 +0530 Subject: [PATCH 4/5] handle corner scnearios of chunk being undefined for batch --- src/v0/destinations/braze/util.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/v0/destinations/braze/util.js b/src/v0/destinations/braze/util.js index 5eb18d5a0f2..b3e60f2c6a2 100644 --- a/src/v0/destinations/braze/util.js +++ b/src/v0/destinations/braze/util.js @@ -420,15 +420,21 @@ const processBatch = (transformedEvents) => { const events = eventsArrayChunks[i]; const purchases = purchaseArrayChunks[i]; - stats.gauge('braze_batch_attributes_pack_size', attributes.length, { - destination_id: destination.ID, - }); - stats.gauge('braze_batch_events_pack_size', events.length, { - destination_id: destination.ID, - }); - stats.gauge('braze_batch_purchase_pack_size', purchases.length, { - destination_id: destination.ID, - }); + if (attributes) { + stats.gauge('braze_batch_attributes_pack_size', attributes.length, { + destination_id: destination.ID, + }); + } + if (events) { + stats.gauge('braze_batch_events_pack_size', events.length, { + destination_id: destination.ID, + }); + } + if (purchases) { + stats.gauge('braze_batch_purchase_pack_size', purchases.length, { + destination_id: destination.ID, + }); + } const response = defaultRequestConfig(); response.endpoint = endpoint; From 17f12a6467f454f99aa1a4c6609b8eca058c14d0 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Tue, 10 Oct 2023 10:49:54 +0530 Subject: [PATCH 5/5] add metrics to prometheus.js --- src/util/prometheus.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/util/prometheus.js b/src/util/prometheus.js index 0899590cd5f..8018750b5df 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -551,6 +551,24 @@ class Prometheus { type: 'gauge', labelNames: ['destType', 'feature'], }, + { + name: 'braze_batch_attributes_pack_size', + help: 'braze_batch_attributes_pack_size', + type: 'gauge', + labelNames: ['destination_id'], + }, + { + name: 'braze_batch_events_pack_size', + help: 'braze_batch_events_pack_size', + type: 'gauge', + labelNames: ['destination_id'], + }, + { + name: 'braze_batch_purchase_pack_size', + help: 'braze_batch_purchase_pack_size', + type: 'gauge', + labelNames: ['destination_id'], + }, // Histograms {