Skip to content

Commit

Permalink
Merge branch 'develop' into feat.intercom-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 authored Dec 9, 2023
2 parents 3c3dd42 + c8e5bfb commit 6128608
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/services/destination/nativeIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -203,6 +204,7 @@ export class NativeIntegrationDestinationService implements DestinationService {
): Promise<UserDeletionResponse[]> {
const response = await Promise.all(
requests.map(async (request) => {
const startTime = new Date();
const { destType } = request;
const destUserDeletionHandler: any = FetchHandler.getDeletionHandler(
destType.toLowerCase(),
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/services/destination/postTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/services/userTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
18 changes: 15 additions & 3 deletions src/util/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -924,7 +936,7 @@ class Prometheus {
'errored',
'statusCode',
'transformationId',
'workspaceId'
'workspaceId',
],
},
{
Expand All @@ -940,9 +952,9 @@ class Prometheus {
'errored',
'statusCode',
'transformationId',
'workspaceId'
'workspaceId',
],
}
},
];

metrics.forEach((metric) => {
Expand Down

0 comments on commit 6128608

Please sign in to comment.