diff --git a/app/client/src/sagas/DebuggerSagas.ts b/app/client/src/sagas/DebuggerSagas.ts index e837cb9eef..af8f9e2423 100644 --- a/app/client/src/sagas/DebuggerSagas.ts +++ b/app/client/src/sagas/DebuggerSagas.ts @@ -51,7 +51,7 @@ import { } from "@appsmith/constants/messages"; import AppsmithConsole from "utils/AppsmithConsole"; import { getWidget } from "./selectors"; -import AnalyticsUtil from "utils/AnalyticsUtil"; +import AnalyticsUtil, { AnalyticsEventType } from "utils/AnalyticsUtil"; import type { Plugin } from "api/PluginApi"; import { getCurrentPageId } from "selectors/editorSelectors"; import type { WidgetProps } from "widgets/BaseWidget"; @@ -421,16 +421,20 @@ function* logDebuggerErrorAnalyticsSaga( const propertyPath = `${widgetType}.${payload.propertyPath}`; // Sending widget type for widgets - AnalyticsUtil.logEvent(payload.eventName, { - entityType: widgetType, - propertyPath, - errorId: payload.errorId, - errorMessages: payload.errorMessages, - pageId: currentPageId, - errorMessage: payload.errorMessage, - errorType: payload.errorType, - appMode: payload.appMode, - }); + AnalyticsUtil.logEvent( + payload.eventName, + { + entityType: widgetType, + propertyPath, + errorId: payload.errorId, + errorMessages: payload.errorMessages, + pageId: currentPageId, + errorMessage: payload.errorMessage, + errorType: payload.errorType, + appMode: payload.appMode, + }, + AnalyticsEventType.error, + ); } else if (payload.entityType === ENTITY_TYPE.ACTION) { const action: Action | undefined = yield select( getAction, @@ -446,17 +450,21 @@ function* logDebuggerErrorAnalyticsSaga( } // Sending plugin name for actions - AnalyticsUtil.logEvent(payload.eventName, { - entityType: pluginName, - propertyPath, - errorId: payload.errorId, - errorMessages: payload.errorMessages, - pageId: currentPageId, - errorMessage: payload.errorMessage, - errorType: payload.errorType, - errorSubType: payload.errorSubType, - appMode: payload.appMode, - }); + AnalyticsUtil.logEvent( + payload.eventName, + { + entityType: pluginName, + propertyPath, + errorId: payload.errorId, + errorMessages: payload.errorMessages, + pageId: currentPageId, + errorMessage: payload.errorMessage, + errorType: payload.errorType, + errorSubType: payload.errorSubType, + appMode: payload.appMode, + }, + AnalyticsEventType.error, + ); } else if (payload.entityType === ENTITY_TYPE.JSACTION) { const action: JSCollection = yield select( getJSCollection, @@ -467,14 +475,18 @@ function* logDebuggerErrorAnalyticsSaga( const pluginName = plugin?.name?.replace(/ /g, ""); // Sending plugin name for actions - AnalyticsUtil.logEvent(payload.eventName, { - entityType: pluginName, - errorId: payload.errorId, - propertyPath: payload.propertyPath, - errorMessages: payload.errorMessages, - pageId: currentPageId, - appMode: payload.appMode, - }); + AnalyticsUtil.logEvent( + payload.eventName, + { + entityType: pluginName, + errorId: payload.errorId, + propertyPath: payload.propertyPath, + errorMessages: payload.errorMessages, + pageId: currentPageId, + appMode: payload.appMode, + }, + AnalyticsEventType.error, + ); } } catch (e) { log.error(e); diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 7754f993a1..0191b1bda8 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -102,6 +102,7 @@ import { fetchFeatureFlagsInit } from "actions/userActions"; import { parseUpdatesAndDeleteUndefinedUpdates } from "./EvaluationSaga.utils"; import { getFeatureFlagsFetched } from "selectors/usersSelectors"; import { evalErrorHandler } from "./EvalErrorHandler"; +import AnalyticsUtil from "utils/AnalyticsUtil"; const APPSMITH_CONFIGS = getAppsmithConfigs(); export const evalWorker = new GracefulWorkerService( @@ -189,7 +190,7 @@ export function* updateDataTreeHandler( configTree, removedPaths, ); - + AnalyticsUtil.setBlockErrorLogs(isCreateFirstTree); if (appMode !== APP_MODE.PUBLISHED) { const jsData: Record = yield select(getAllJSActionsData); postEvalActionsToDispatch.push(executeJSUpdates(jsUpdates)); diff --git a/app/client/src/utils/AnalyticsUtil.tsx b/app/client/src/utils/AnalyticsUtil.tsx index 5faa1fa5a9..19d972455a 100644 --- a/app/client/src/utils/AnalyticsUtil.tsx +++ b/app/client/src/utils/AnalyticsUtil.tsx @@ -28,13 +28,17 @@ function getApplicationId(location: Location) { return appId; } +export enum AnalyticsEventType { + error = "error", +} + class AnalyticsUtil { static cachedAnonymoustId: string; static cachedUserId: string; static user?: User = undefined; static blockTrackEvent: boolean | undefined; static instanceId?: string = ""; - + static blockErrorLogs = false; static initializeSmartLook(id: string) { smartlookClient.init(id); } @@ -119,10 +123,20 @@ class AnalyticsUtil { return initPromise; } - static logEvent(eventName: EventName, eventData: any = {}) { + static logEvent( + eventName: EventName, + eventData: any = {}, + eventType?: AnalyticsEventType, + ) { if (AnalyticsUtil.blockTrackEvent) { return; } + if ( + AnalyticsUtil.blockErrorLogs && + eventType === AnalyticsEventType.error + ) { + return; + } const windowDoc: any = window; let finalEventData = eventData; @@ -255,6 +269,9 @@ class AnalyticsUtil { AnalyticsUtil.blockTrackEvent = false; (window as any).analytics = undefined; } + static setBlockErrorLogs(value: boolean) { + AnalyticsUtil.blockErrorLogs = value; + } } export default AnalyticsUtil;