Skip to content

Commit

Permalink
handle corner scnearios of chunk being undefined for batch
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Oct 10, 2023
1 parent 84ddf7d commit 917d1fa
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 917d1fa

Please sign in to comment.