diff --git a/packages/core/getBusyTimes.ts b/packages/core/getBusyTimes.ts index 9348d6797f..6b156fe1ee 100644 --- a/packages/core/getBusyTimes.ts +++ b/packages/core/getBusyTimes.ts @@ -141,6 +141,8 @@ export async function getBusyTimes(params: { }, }); + getBookingsSpan.end(); + const bookingSeatCountMap: { [x: string]: number } = {}; const busyTimes = bookings.reduce( (aggregate: EventBusyDetails[], { id, startTime, endTime, eventType, title, ...rest }) => { diff --git a/packages/trpc/server/routers/viewer/slots/util.ts b/packages/trpc/server/routers/viewer/slots/util.ts index 38dae3bb59..ba884cc764 100644 --- a/packages/trpc/server/routers/viewer/slots/util.ts +++ b/packages/trpc/server/routers/viewer/slots/util.ts @@ -306,6 +306,8 @@ export async function getAvailableSlots({ input, ctx }: GetScheduleOptions) { }, }; + const getBookingsSpan = tracer.startSpan("getBookingsAllUsers", undefined, context.active()); + const currentBookingsAllUsers = await prisma.booking.findMany({ where: { OR: [ @@ -355,6 +357,8 @@ export async function getAvailableSlots({ input, ctx }: GetScheduleOptions) { }, }); + getBookingsSpan.end(); + /* We get all users working hours and busy slots */ const userAvailability = await Promise.all( usersWithCredentials.map(async (currentUser) => {