Clean up and enhance logging for messaging and calendar (#17498)
This PR reduces noise to signal ratio for messaging and calendar logging in production Impact would be faster queries and debugging
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ export class CalDavGetEventsService {
|
||||
>,
|
||||
syncCursor?: string,
|
||||
): Promise<GetCalendarEventsResponse> {
|
||||
this.logger.log(`Getting calendar events for ${connectedAccount.handle}`);
|
||||
this.logger.debug(`Getting calendar events for ${connectedAccount.handle}`);
|
||||
|
||||
try {
|
||||
const caldavCalendarClient =
|
||||
@@ -46,7 +46,7 @@ export class CalDavGetEventsService {
|
||||
syncCursor: syncCursor ? JSON.parse(syncCursor) : undefined,
|
||||
});
|
||||
|
||||
this.logger.log(
|
||||
this.logger.debug(
|
||||
`Found ${result.events.length} calendar events for ${connectedAccount.handle}`,
|
||||
);
|
||||
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ export class GoogleCalendarGetEventsService {
|
||||
this.logger.error(
|
||||
`Calendar event import error for Google Calendar. status: ${error.response?.status}`,
|
||||
);
|
||||
this.logger.log(error);
|
||||
this.logger.error(error);
|
||||
const googleCalendarError = {
|
||||
code: error.response?.status,
|
||||
reason:
|
||||
|
||||
+7
-5
@@ -85,7 +85,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
calendarChannel: Pick<CalendarChannelWorkspaceEntity, 'id'>,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
this.logger.log(
|
||||
this.logger.debug(
|
||||
`CalendarChannelId: ${calendarChannel.id} - Sync cursor error, resetting and rescheduling`,
|
||||
);
|
||||
|
||||
@@ -112,7 +112,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
);
|
||||
|
||||
const calendarEventImportException = new CalendarEventImportException(
|
||||
`Temporary error occurred ${CALENDAR_THROTTLE_MAX_ATTEMPTS} times while importing calendar events for calendar channel ${calendarChannel.id.slice(0, 5)}... in workspace ${workspaceId} with throttleFailureCount ${calendarChannel.throttleFailureCount}`,
|
||||
`Temporary error occurred ${CALENDAR_THROTTLE_MAX_ATTEMPTS} times while importing calendar events for calendar channel ${calendarChannel.id} in workspace ${workspaceId} with throttleFailureCount ${calendarChannel.throttleFailureCount}`,
|
||||
CalendarEventImportExceptionCode.UNKNOWN,
|
||||
);
|
||||
|
||||
@@ -121,6 +121,8 @@ export class CalendarEventImportErrorHandlerService {
|
||||
{
|
||||
additionalData: {
|
||||
calendarChannelId: calendarChannel.id,
|
||||
syncStep,
|
||||
throttleFailureCount: calendarChannel.throttleFailureCount,
|
||||
},
|
||||
workspace: {
|
||||
id: workspaceId,
|
||||
@@ -194,17 +196,17 @@ export class CalendarEventImportErrorHandlerService {
|
||||
);
|
||||
|
||||
const calendarEventImportException = new CalendarEventImportException(
|
||||
`Unknown error importing calendar events for calendar channel ${calendarChannel.id.slice(0, 5)}... in workspace ${workspaceId}: ${exception.message}`,
|
||||
`Unknown error importing calendar events for calendar channel ${calendarChannel.id} in workspace ${workspaceId}: ${exception.message}`,
|
||||
CalendarEventImportExceptionCode.UNKNOWN,
|
||||
);
|
||||
|
||||
this.logger.log(exception);
|
||||
this.logger.error(exception);
|
||||
this.exceptionHandlerService.captureExceptions(
|
||||
[calendarEventImportException],
|
||||
{
|
||||
additionalData: {
|
||||
calendarChannelId: calendarChannel.id,
|
||||
exception,
|
||||
exceptionMessage: exception.message,
|
||||
},
|
||||
workspace: {
|
||||
id: workspaceId,
|
||||
|
||||
+6
-3
@@ -41,6 +41,10 @@ export class CalendarFetchEventsService {
|
||||
connectedAccount: ConnectedAccountWorkspaceEntity,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
this.logger.log(
|
||||
`WorkspaceId: ${workspaceId}, CalendarChannelId: ${calendarChannel.id} - Fetching calendar events`,
|
||||
);
|
||||
|
||||
await this.calendarChannelSyncStatusService.markAsCalendarEventListFetchOngoing(
|
||||
[calendarChannel.id],
|
||||
workspaceId,
|
||||
@@ -141,10 +145,9 @@ export class CalendarFetchEventsService {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.log(
|
||||
`Calendar event fetch error for workspace ${workspaceId} and calendar channel ${calendarChannel.id}`,
|
||||
this.logger.error(
|
||||
`WorkspaceId: ${workspaceId}, CalendarChannelId: ${calendarChannel.id} - Calendar event fetch error: ${error.message}`,
|
||||
);
|
||||
this.logger.error(error);
|
||||
await this.calendarEventImportErrorHandlerService.handleDriverException(
|
||||
error,
|
||||
CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH,
|
||||
|
||||
Reference in New Issue
Block a user