From 7347f3793b0464aef534e9c3994ca5d4e5597c77 Mon Sep 17 00:00:00 2001 From: stephhuynh18 Date: Tue, 20 Feb 2024 14:46:18 -0800 Subject: [PATCH] Add metrics to count not found errors --- src/controllers/request-controller.ts | 1 + src/settings.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/controllers/request-controller.ts b/src/controllers/request-controller.ts index 12441c127..608151453 100644 --- a/src/controllers/request-controller.ts +++ b/src/controllers/request-controller.ts @@ -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, }) diff --git a/src/settings.ts b/src/settings.ts index e28df7cc4..af217802b 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -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', }