Skip to content

Commit 1ff5d57

Browse files
feat: distributed tracing - 2 (calcom#24861)
* feat: distributed tracing 2 * feat: distributed tracing 2 * refactor: feedback * refactor: feedback * fix: type error * fix: trpc error --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
1 parent 19641ff commit 1ff5d57

7 files changed

Lines changed: 158 additions & 67 deletions

File tree

apps/web/pages/api/book/event.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import getIP from "@calcom/lib/getIP";
1010
import { piiHasher } from "@calcom/lib/server/PiiHasher";
1111
import { checkCfTurnstileToken } from "@calcom/lib/server/checkCfTurnstileToken";
1212
import { defaultResponder } from "@calcom/lib/server/defaultResponder";
13-
import prisma from "@calcom/prisma";
13+
import type { TraceContext } from "@calcom/lib/tracing";
14+
import { prisma } from "@calcom/prisma";
1415
import { CreationSource } from "@calcom/prisma/enums";
1516

16-
async function handler(req: NextApiRequest & { userId?: number }) {
17+
async function handler(req: NextApiRequest & { userId?: number; traceContext: TraceContext }) {
1718
const userIp = getIP(req);
1819

1920
if (process.env.NEXT_PUBLIC_CLOUDFLARE_USE_TURNSTILE_IN_BOOKER === "1") {
@@ -52,8 +53,10 @@ async function handler(req: NextApiRequest & { userId?: number }) {
5253
userId: session?.user?.id || -1,
5354
hostname: req.headers.host || "",
5455
forcedSlug: req.headers["x-cal-force-slug"] as string | undefined,
56+
traceContext: req.traceContext,
5557
},
5658
});
59+
5760
// const booking = await createBookingThroughFactory();
5861
return booking;
5962

packages/features/bookings/lib/dto/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
import type getBookingDataSchema from "@calcom/features/bookings/lib/getBookingDataSchema";
66
import type getBookingDataSchemaForApi from "@calcom/features/bookings/lib/getBookingDataSchemaForApi";
7+
import type { TraceContext } from "@calcom/lib/tracing";
78
import type { SchedulingType } from "@calcom/prisma/enums";
89

910
import type { ExtendedBookingCreateBody } from "../bookingCreateBodySchema";
@@ -37,6 +38,7 @@ export type CreateBookingMeta = {
3738
hostname?: string;
3839
forcedSlug?: string;
3940
noEmail?: boolean;
41+
traceContext?: TraceContext;
4042
} & PlatformParams;
4143

4244
export type BookingHandlerInput = {

0 commit comments

Comments
 (0)