refactor: Uses withReporting to force named functions for tracing (#21219)

This commit is contained in:
Omar López authored and GitHub committed 2025-05-12 13:22:52 -04:00
1 parent 79d695236f
commit b3d3cb1dee
35 files changed
+853 -393

No files matched your search

+24 -7
View File
@@ -8,6 +8,7 @@ import { getEventName } from "@calcom/lib/event";
import { formatCalEvent } from "@calcom/lib/formatCalendarEvent";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
import { withReporting } from "@calcom/lib/sentryWrapper";
import type { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
@@ -98,7 +99,7 @@ const eventTypeDisableHostEmail = (metadata?: EventTypeMetadata) => {
return !!metadata?.disableStandardEmails?.all?.host;
};
export const sendScheduledEmailsAndSMS = async (
const _sendScheduledEmailsAndSMS = async (
calEvent: CalendarEvent,
eventNameObject?: EventNameObjectType,
hostEmailDisabled?: boolean,
@@ -145,6 +146,11 @@ export const sendScheduledEmailsAndSMS = async (
await successfullyScheduledSms.sendSMSToAttendees();
};
export const sendScheduledEmailsAndSMS = withReporting(
_sendScheduledEmailsAndSMS,
"sendScheduledEmailsAndSMS"
);
// for rescheduled round robin booking that assigned new members
export const sendRoundRobinScheduledEmailsAndSMS = async ({
calEvent,
@@ -245,7 +251,7 @@ export const sendRoundRobinCancelledEmailsAndSMS = async (
await Promise.all(emailsAndSMSToSend);
};
export const sendRescheduledEmailsAndSMS = async (
const _sendRescheduledEmailsAndSMS = async (
calEvent: CalendarEvent,
eventTypeMetadata?: EventTypeMetadata
) => {
@@ -276,6 +282,10 @@ export const sendRescheduledEmailsAndSMS = async (
const successfullyReScheduledSms = new EventSuccessfullyReScheduledSMS(calEvent);
await successfullyReScheduledSms.sendSMSToAttendees();
};
export const sendRescheduledEmailsAndSMS = withReporting(
_sendRescheduledEmailsAndSMS,
"sendRescheduledEmailsAndSMS"
);
export const sendRescheduledSeatEmailAndSMS = async (
calEvent: CalendarEvent,
@@ -370,10 +380,7 @@ export const sendCancelledSeatEmailsAndSMS = async (
await cancelledSeatSMS.sendSMSToAttendee(cancelledAttendee);
};
export const sendOrganizerRequestEmail = async (
calEvent: CalendarEvent,
eventTypeMetadata?: EventTypeMetadata
) => {
const _sendOrganizerRequestEmail = async (calEvent: CalendarEvent, eventTypeMetadata?: EventTypeMetadata) => {
if (eventTypeDisableHostEmail(eventTypeMetadata)) return;
const calendarEvent = formatCalEvent(calEvent);
@@ -390,7 +397,12 @@ export const sendOrganizerRequestEmail = async (
await Promise.all(emailsToSend);
};
export const sendAttendeeRequestEmailAndSMS = async (
export const sendOrganizerRequestEmail = withReporting(
_sendOrganizerRequestEmail,
"sendOrganizerRequestEmail"
);
const _sendAttendeeRequestEmailAndSMS = async (
calEvent: CalendarEvent,
attendee: Person,
eventTypeMetadata?: EventTypeMetadata
@@ -403,6 +415,11 @@ export const sendAttendeeRequestEmailAndSMS = async (
await eventRequestSms.sendSMSToAttendee(attendee);
};
export const sendAttendeeRequestEmailAndSMS = withReporting(
_sendAttendeeRequestEmailAndSMS,
"sendAttendeeRequestEmailAndSMS"
);
export const sendDeclinedEmailsAndSMS = async (
calEvent: CalendarEvent,
eventTypeMetadata?: EventTypeMetadata