From 6bb60e36fd94396a3a65778bcba6f03b47bf57b9 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Tue, 3 Sep 2024 08:54:12 +0200 Subject: [PATCH] chore: Log cold starts of /v1/slots (#16468) --- apps/api/v1/pages/api/slots/_get.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/api/v1/pages/api/slots/_get.ts b/apps/api/v1/pages/api/slots/_get.ts index 3f6ef9b29c..e4323d0037 100644 --- a/apps/api/v1/pages/api/slots/_get.ts +++ b/apps/api/v1/pages/api/slots/_get.ts @@ -3,6 +3,7 @@ import utc from "dayjs/plugin/utc"; import type { NextApiRequest, NextApiResponse } from "next"; import dayjs from "@calcom/dayjs"; +import { IS_PRODUCTION } from "@calcom/lib/constants"; import { isSupportedTimeZone } from "@calcom/lib/date-fns"; import { HttpError } from "@calcom/lib/http-error"; import { defaultResponder } from "@calcom/lib/server"; @@ -17,8 +18,15 @@ import { getHTTPStatusCodeFromError } from "@trpc/server/http"; dayjs.extend(utc); dayjs.extend(timezone); +let isColdStart = true; + async function handler(req: NextApiRequest, res: NextApiResponse) { try { + if (isColdStart && IS_PRODUCTION) { + console.log("Cold start of /v1/slots detected"); + isColdStart = false; + } + const { usernameList, ...rest } = req.query; let slugs = usernameList; if (!Array.isArray(usernameList)) {