From 71207406b56a24e17d28ebb9a4a4cd1a657fc600 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Fri, 6 Dec 2024 12:24:52 +0530 Subject: [PATCH 1/2] chore: add metrics for mailjet --- src/util/prometheus.js | 6 ++++++ src/v0/destinations/mailjet/transform.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/util/prometheus.js b/src/util/prometheus.js index c8dd55068b..e0ff110481 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -520,6 +520,12 @@ class Prometheus { type: 'counter', labelNames: ['destination_id'], }, + { + name: 'mailjet_packing_size', + help: 'mailjet_packing_size', + type: 'gauge', + labelNames: ['destination_id'], + }, { name: 'hs_batch_size', help: 'hs_batch_size', diff --git a/src/v0/destinations/mailjet/transform.js b/src/v0/destinations/mailjet/transform.js index 78b4f766d1..0a742b4cf7 100644 --- a/src/v0/destinations/mailjet/transform.js +++ b/src/v0/destinations/mailjet/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); +const stats = require('../../../util/stats'); const { getSuccessRespEvents, defaultRequestConfig, @@ -105,6 +106,9 @@ const batchEvents = (successRespList) => { const eventChunks = lodash.chunk(eventGroups[combination], MAX_BATCH_SIZE); // eventChunks = [[e1,e2,e3,..batchSize],[e1,e2,e3,..batchSize]..] eventChunks.forEach((chunk) => { + stats.gauge('mailjet_packing_size', chunk.length, { + group: combination, + }); const batchEventResponse = generateBatchedPaylaodForArray(chunk, combination); batchedResponseList.push( getSuccessRespEvents( From e6af2668c5b9fe7e457dd19ddf8cd3879caa039c Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Fri, 6 Dec 2024 12:39:28 +0530 Subject: [PATCH 2/2] chore: fix label --- src/util/prometheus.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/prometheus.js b/src/util/prometheus.js index e0ff110481..a4c12e4ea8 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -524,7 +524,7 @@ class Prometheus { name: 'mailjet_packing_size', help: 'mailjet_packing_size', type: 'gauge', - labelNames: ['destination_id'], + labelNames: ['group'], }, { name: 'hs_batch_size',