feat: dist tracing 4 (#25574)

* feat: distributed tracing 2

* feat: distributed tracing 2

* refactor: feedback

* refactor: feedback

* fix: type error

* fix: trpc error

* feat: distributed tracing - 3

* chore: translation

* refactor: improvements

* fix: feedback

* chore: remove

* feat: dist tracing 4

* fix: type errors

* fix: type errors

* fix: remove string type

* fix: type errors
This commit is contained in:
Udit Takkar authored and GitHub committed 2025-12-15 10:43:22 +00:00
1 parent 0d4108dd69
commit 4e1d05a7e7
15 files changed
+127 -26

No files matched your search

@@ -2,14 +2,13 @@ import type { getEventTypeResponse } from "@calcom/features/bookings/lib/handleN
import { scheduleEmailReminder } from "@calcom/features/ee/workflows/lib/reminders/emailReminderManager";
import type { Workflow } from "@calcom/features/ee/workflows/lib/types";
import type { getDefaultEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
import logger from "@calcom/lib/logger";
import { withReporting } from "@calcom/lib/sentryWrapper";
import type { TraceContext } from "@calcom/lib/tracing";
import { distributedTracing } from "@calcom/lib/tracing/factory";
import { WorkflowTriggerEvents, TimeUnit, WorkflowActions, WorkflowTemplates } from "@calcom/prisma/enums";
import type { ExtendedCalendarEvent } from "./reminderScheduler";
const log = logger.getSubLogger({ prefix: ["[scheduleMandatoryReminder]"] });
export type NewBookingEventType = Awaited<ReturnType<typeof getDefaultEvent>> | getEventTypeResponse;
async function _scheduleMandatoryReminder({
@@ -20,6 +19,7 @@ async function _scheduleMandatoryReminder({
seatReferenceUid,
isPlatformNoEmail = false,
isDryRun = false,
traceContext,
}: {
evt: ExtendedCalendarEvent;
workflows: Workflow[];
@@ -28,7 +28,26 @@ async function _scheduleMandatoryReminder({
seatReferenceUid: string | undefined;
isPlatformNoEmail?: boolean;
isDryRun?: boolean;
traceContext: TraceContext;
}) {
const reminderMeta = {
eventTitle: evt.title,
attendeeCount: evt.attendees.length,
organizerId: evt.organizer.id,
requiresConfirmation,
hideBranding,
seatReferenceUid,
isPlatformNoEmail,
};
const spanContext = distributedTracing.createSpan(
traceContext,
"schedule_mandatory_reminder",
reminderMeta
);
const tracingLogger = distributedTracing.getTracingLogger(spanContext);
if (isDryRun) return;
if (isPlatformNoEmail) return;
try {
@@ -67,11 +86,11 @@ async function _scheduleMandatoryReminder({
verifiedAt: new Date(),
});
} catch (error) {
log.error("Error while scheduling mandatory reminders", JSON.stringify({ error }));
tracingLogger.error("Error while scheduling mandatory reminders", JSON.stringify({ error }));
}
}
} catch (error) {
log.error("Error while scheduling mandatory reminders", JSON.stringify({ error }));
tracingLogger.error("Error while scheduling mandatory reminders", JSON.stringify({ error }));
}
}