Skip to content

Commit

Permalink
[#IOPID-2503] adding unsampled tracking of failures (#247)
Browse files Browse the repository at this point in the history

Co-authored-by: Greta Quadrati <75862507+gquadrati@users.noreply.github.com>
  • Loading branch information
arcogabbo and gquadrati authored Nov 20, 2024
1 parent 9558674 commit 3b55fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions UserDataDeleteOrchestratorV2/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,12 @@ export const createUserDataDeleteOrchestratorHandler = (
)}`
);

// Unsampled tracking of failure
trackUserDataDeleteException(
"failed",
E.toError(error),
currentUserDataProcessing
currentUserDataProcessing,
false
);

const orchestrationFailure = pipe(
Expand Down Expand Up @@ -695,7 +697,8 @@ export const createUserDataDeleteOrchestratorHandler = (
trackUserDataDeleteException(
"unhandled_failed_status",
new Error(readableReport(err)),
currentUserDataProcessing
currentUserDataProcessing,
false
);
throw new Error(
`Activity SetUserDataProcessingStatusActivity (status=FAILED) failed: ${readableReport(
Expand Down
6 changes: 4 additions & 2 deletions utils/appinsightsEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export const trackUserDataDeleteEvent = (
export const trackUserDataDeleteException = (
eventName: string,
exception: Error,
userDataProcessing: UserDataProcessing
userDataProcessing: UserDataProcessing,
isSampled: boolean = true
) =>
trackException({
exception,
Expand All @@ -34,7 +35,8 @@ export const trackUserDataDeleteException = (
},
tagOverrides: {
"ai.operation.id": userDataProcessing.userDataProcessingId,
"ai.operation.parentId": userDataProcessing.userDataProcessingId
"ai.operation.parentId": userDataProcessing.userDataProcessingId,
samplingEnabled: String(isSampled)
}
});

Expand Down

0 comments on commit 3b55fb3

Please sign in to comment.