Skip to content

Commit

Permalink
Record metrics for unsubscribe all success and failure
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmw committed May 17, 2024
1 parent cd5919f commit 74b70bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/server/models/Metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type ConditionalMetrics =
| 'SignOut'
| 'SignOutGlobal'
| 'Unsubscribe'
| 'UnsubscribeAll'
| 'Subscribe'
| 'UpdatePassword'
| 'RecaptchaMiddleware'
Expand Down
21 changes: 2 additions & 19 deletions src/server/routes/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,15 @@ router.post(
res.locals.requestId,
);

// TODO: metrics?
// trackMetric(`${subscriptionActionName(action)}::Success`);

// const html = renderer(`/${action}/success`, {
// requestState: mergeRequestState(res.locals, {
// pageData: buildPageData(emailType, subscriptionData.emailId),
// }),
// pageTitle: `${subscriptionActionName(action)} Confirmation`,
// });
trackMetric(`UnsubscribeAll::Success`);

return res.status(200).send();
} catch (error) {
logger.error(`${req.method} ${req.originalUrl} Error`, error, {
request_id: res.locals.requestId,
});

// trackMetric(`${subscriptionActionName(action)}::Failure`);

// const html = renderer(`/${action}/error`, {
// requestState: mergeRequestState(res.locals, {
// pageData: {
// accountManagementUrl,
// },
// }),
// pageTitle: `${subscriptionActionName(action)} Error`,
// });
trackMetric(`UnsubscribeAll::Failure`);

return res.status(500).send();
}
Expand Down

0 comments on commit 74b70bf

Please sign in to comment.