From b3437a34358d5fd5b1eb63f30a5a695f39aa84ff Mon Sep 17 00:00:00 2001 From: Abhimanyu Babbar Date: Thu, 7 Dec 2023 14:45:33 +0530 Subject: [PATCH 1/2] fix(dm): add workspaceId in common metadata to be returned to the callers (#2868) Add workspaceId in common metadata to be returned to the callers --- src/services/userTransform.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/userTransform.ts b/src/services/userTransform.ts index ddd5c82f67..bf34e3d82a 100644 --- a/src/services/userTransform.ts +++ b/src/services/userTransform.ts @@ -65,6 +65,7 @@ export class UserTransformService { sourceId: eventsToProcess[0]?.metadata?.sourceId, destinationId: eventsToProcess[0]?.metadata.destinationId, destinationType: eventsToProcess[0]?.metadata.destinationType, + workspaceId: eventsToProcess[0]?.metadata.workspaceId, messageIds, }; From c8e5bfb34240d092fb8979f916ac770c667fb652 Mon Sep 17 00:00:00 2001 From: Anant Jain <62471433+anantjain45823@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:19:01 +0530 Subject: [PATCH 2/2] chore: add user deletion stats for regulation worker at destType level (#2884) --- src/services/destination/nativeIntegration.ts | 7 +++++++ src/services/destination/postTransformation.ts | 2 +- src/util/prometheus.js | 18 +++++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/services/destination/nativeIntegration.ts b/src/services/destination/nativeIntegration.ts index 510fa80362..6bb79ce27a 100644 --- a/src/services/destination/nativeIntegration.ts +++ b/src/services/destination/nativeIntegration.ts @@ -18,6 +18,7 @@ import { DestinationPostTransformationService } from './postTransformation'; import networkHandlerFactory from '../../adapters/networkHandlerFactory'; import { FetchHandler } from '../../helpers/fetchHandlers'; import tags from '../../v0/util/tags'; +import stats from '../../util/stats'; export class NativeIntegrationDestinationService implements DestinationService { public init() {} @@ -203,6 +204,7 @@ export class NativeIntegrationDestinationService implements DestinationService { ): Promise { const response = await Promise.all( requests.map(async (request) => { + const startTime = new Date(); const { destType } = request; const destUserDeletionHandler: any = FetchHandler.getDeletionHandler( destType.toLowerCase(), @@ -219,6 +221,11 @@ export class NativeIntegrationDestinationService implements DestinationService { ...request, rudderDestInfo, }); + stats.timing('regulation_worker_requests_dest_latency', startTime, { + feature: tags.FEATURES.USER_DELETION, + implementation: tags.IMPLEMENTATIONS.NATIVE, + destType, + }); return result; } catch (error: any) { const metaTO = this.getTags(destType, 'unknown', 'unknown', tags.FEATURES.USER_DELETION); diff --git a/src/services/destination/postTransformation.ts b/src/services/destination/postTransformation.ts index 0b91eb7cc1..076f5ba55e 100644 --- a/src/services/destination/postTransformation.ts +++ b/src/services/destination/postTransformation.ts @@ -161,7 +161,7 @@ export class DestinationPostTransformationService { metaTo: MetaTransferObject, ): UserDeletionResponse { const errObj = generateErrorObject(error, metaTo.errorDetails, false); - // TODO: Add stat tags here + stats.increment('regulation_worker_user_deletion_failure', metaTo.errorDetails); const resp = { statusCode: errObj.status, error: errObj.message, diff --git a/src/util/prometheus.js b/src/util/prometheus.js index ec8ad61789..d7ba3b7c61 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -451,6 +451,12 @@ class Prometheus { type: 'counter', labelNames: ['writeKey', 'timestamp'], }, + { + name: 'regulation_worker_user_deletion_failure', + help: 'regulation_worker_user_deletion_failure', + type: 'counter', + labelNames: ['destType', 'module', 'implementation', 'feature'], + }, { name: 'shopify_server_side_identifier_event', help: 'shopify_server_side_identifier_event', @@ -605,6 +611,12 @@ class Prometheus { type: 'histogram', labelNames: ['sourceType', 'destinationType', 'k8_namespace'], }, + { + name: 'regulation_worker_requests_dest_latency', + help: 'regulation_worker_requests_dest_latency', + type: 'histogram', + labelNames: ['feature', 'implementation', 'destType'], + }, { name: 'dest_transform_request_latency', help: 'dest_transform_request_latency', @@ -924,7 +936,7 @@ class Prometheus { 'errored', 'statusCode', 'transformationId', - 'workspaceId' + 'workspaceId', ], }, { @@ -940,9 +952,9 @@ class Prometheus { 'errored', 'statusCode', 'transformationId', - 'workspaceId' + 'workspaceId', ], - } + }, ]; metrics.forEach((metric) => {