Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add user deletion stats for regulation worker at destType level #2884

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
anantjain45823 marked this conversation as resolved.
Show resolved Hide resolved
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
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 @@ -599,6 +605,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 @@ -918,7 +930,7 @@ class Prometheus {
'errored',
'statusCode',
'transformationId',
'workspaceId'
'workspaceId',
],
},
{
Expand All @@ -934,9 +946,9 @@ class Prometheus {
'errored',
'statusCode',
'transformationId',
'workspaceId'
'workspaceId',
],
}
},
];

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