Skip to content

Commit

Permalink
Add metrics to count not found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stephhuynh18 committed Feb 20, 2024
1 parent d7fe1aa commit 7347f37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/controllers/request-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class RequestController {
return res.status(StatusCodes.OK).json(response)
} catch (err: any) {
if (err instanceof RequestDoesNotExistError) {
Metrics.count(METRIC_NAMES.REQUEST_NOT_FOUND, 1, { source: parseOrigin(req) })
return res.status(StatusCodes.NOT_FOUND).json({
error: err.message,
})
Expand Down
1 change: 1 addition & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ export enum METRIC_NAMES {
LEGACY_REQUESTED = 'legacy_requested',
REQUEST_INVALID = 'request_invalid',
REQUEST_NOT_CREATED = 'request_not_created',
REQUEST_NOT_FOUND = 'request_not_found',
}

0 comments on commit 7347f37

Please sign in to comment.