chore: ce - remove sentry performance tracker (#35710)

## Description
Fix the following errors

### POST https://o296332.ingest.sentry.io/api/1546547/envelope/... 429
(Too Many Requests)

We have an integration with Sentry to instrument page loads and other
transactions. This is no longer used. All page load metrics are
collected using a new relic integration.
The sentry transactions api was throwing a 429 error when we exceed our
trial quota. Removing the integration should curb this error.

<img width="1181" alt="Screenshot 2024-08-15 at 1 22 28 PM"
src="https://github.com/user-attachments/assets/543c0ec1-e87f-4439-b715-e75b3a6fd3ed">

[Slack thread
](https://theappsmith.slack.com/archives/CGBPVEJ5C/p1723699775838509)for
more context on our sentry sub exceeding its quota.

### TypeError: e.className.split is not a function at t.value
(PageLoadInstrumentation.ts:112:33)

Add a type check for string.


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10400625143>
> Commit: fc83198b613a973c9a02644fc742947a92bfbd3c
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10400625143&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 15 Aug 2024 08:45:49 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Removed performance tracking functionality across various components
and sagas, simplifying the codebase and reducing overhead.
- **Bug Fixes**
- No specific bug fixes were made; improvements focus on performance
tracking removal.
- **Chores**
- Eliminated unnecessary dependencies related to performance metrics,
streamlining the application's dependency management.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Diljit 2024-08-15 19:40:53 +05:30 committed by GitHub
parent ee9cd3b29d
commit ed17ee0376
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 18 additions and 756 deletions

View File

@ -83,7 +83,6 @@
"@opentelemetry/semantic-conventions": "1.25.1",
"@react-types/shared": "^3.23.0",
"@sentry/react": "^6.2.4",
"@sentry/tracing": "^6.2.4",
"@shared/ast": "workspace:^",
"@shared/dsl": "workspace:^",
"@tanstack/virtual-core": "^3.0.0-beta.18",

View File

@ -7,6 +7,7 @@ import type {
FCPMetricWithAttribution,
NavigationTimingPolyfillEntry,
} from "web-vitals";
import isString from "lodash/isString";
export class PageLoadInstrumentation extends InstrumentationBase {
// PerformanceObserver to observe resource timings
@ -108,7 +109,7 @@ export class PageLoadInstrumentation extends InstrumentationBase {
}
const elementTestId = element.getAttribute("data-testid");
const className = element.className
const className = isString(element.className)
? "." + element.className.split(" ").join(".")
: "";
const elementId = element.id ? `#${element.id}` : "";

View File

@ -1,7 +1,4 @@
import type { AppsmithUIConfigs } from "./types";
import { Integrations } from "@sentry/tracing";
import * as Sentry from "@sentry/react";
import { createBrowserHistory } from "history";
export interface INJECTED_CONFIGS {
sentry: {
@ -240,17 +237,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
release: sentryRelease.value,
environment: sentryENV.value,
normalizeDepth: 3,
integrations: [
typeof window === "undefined"
? // The Browser Tracing instrumentation isnt working (and is unnecessary) in the worker environment
undefined
: new Integrations.BrowserTracing({
// Can also use reactRouterV4Instrumentation
routingInstrumentation: Sentry.reactRouterV5Instrumentation(
createBrowserHistory(),
),
}),
].filter((i) => i !== undefined),
tracesSampleRate: 0.1,
},
smartLook: {

View File

@ -13,9 +13,6 @@ export interface AppsmithUIConfigs {
dsn: string;
release: string;
environment: string;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
integrations: any[];
normalizeDepth: number;
tracesSampleRate: number;
};

View File

@ -75,9 +75,6 @@ import { useHistory, useLocation, useRouteMatch } from "react-router-dom";
import { getCurrentUser } from "selectors/usersSelectors";
import styled, { ThemeContext } from "styled-components";
import { getNextEntityName, getRandomPaletteColor } from "utils/AppsmithUtils";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { getAppsmithConfigs } from "ee/configs";
import type { Workspace } from "ee/constants/workspaceConstants";
@ -1120,8 +1117,6 @@ export class Applications<
}
componentDidMount() {
PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK);
PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP);
const urlParams = new URLSearchParams(window.location.search);
const workspaceIdFromQueryParams = urlParams.get("workspaceId");
this.props.getAllWorkspaces({

View File

@ -1,6 +1,6 @@
import React, { useEffect } from "react";
import React from "react";
import { Route, Switch } from "react-router-dom";
import { useLocation, useRouteMatch } from "react-router";
import { useRouteMatch } from "react-router";
import ApiEditor from "pages/Editor/APIEditor";
import QueryEditor from "pages/Editor/QueryEditor";
import JSEditor from "pages/Editor/JSEditor";
@ -13,9 +13,6 @@ import {
JS_COLLECTION_ID_PATH,
QUERIES_EDITOR_ID_PATH,
} from "constants/routes";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import * as Sentry from "@sentry/react";
import { SaaSEditorRoutes } from "pages/Editor/SaaSEditor/routes";
import OnboardingChecklist from "pages/Editor/FirstTimeUserOnboarding/Checklist";
@ -26,16 +23,6 @@ const SentryRoute = Sentry.withSentryRouting(Route);
function EditorRoutes() {
const { path } = useRouteMatch();
const { pathname } = useLocation();
useEffect(() => {
return () => {
PerformanceTracker.startTracking(
PerformanceTransactionName.CLOSE_SIDE_PANE,
{ path: pathname },
);
};
});
return (
<Switch key={path}>

View File

@ -97,9 +97,6 @@ import type { UrlDataState } from "reducers/entityReducers/appReducer";
import { APP_MODE } from "entities/App";
import { clearEvalCache } from "../../sagas/EvaluationsSaga";
import { getQueryParams } from "utils/URLUtils";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import log from "loglevel";
import { migrateIncorrectDynamicBindingPathLists } from "utils/migrations/IncorrectDynamicBindingPathLists";
import * as Sentry from "@sentry/react";
@ -298,10 +295,6 @@ export function* fetchPageSaga(action: ReduxAction<FetchPageActionPayload>) {
isFirstLoad = false,
pageWithMigratedDsl,
} = action.payload;
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
{ pageId },
);
const params: FetchPageRequest = { pageId, migrateDSL: true };
const fetchPageResponse: FetchPageResponse = yield call(
@ -315,18 +308,8 @@ export function* fetchPageSaga(action: ReduxAction<FetchPageActionPayload>) {
pageId,
isFirstLoad,
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
);
} catch (error) {
log.error(error);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
{
failed: true,
},
);
yield put({
type: ReduxActionErrorTypes.FETCH_PAGE_ERROR,
payload: {
@ -342,13 +325,7 @@ export function* fetchPublishedPageSaga(
try {
const { bustCache, firstLoad, pageId, pageWithMigratedDsl } =
action.payload;
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
{
pageId: pageId,
published: true,
},
);
const params = { pageId, bustCache };
const response: FetchPageResponse = yield call(
getFromServerWhenNoPrefetchedResult,
@ -392,18 +369,8 @@ export function* fetchPublishedPageSaga(
if (!firstLoad) {
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
}
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
);
}
} catch (error) {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_API,
{
failed: true,
},
);
yield put({
type: ReduxActionErrorTypes.FETCH_PUBLISHED_PAGE_ERROR,
payload: {
@ -447,12 +414,7 @@ export function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) {
widgets,
editorConfigs,
);
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.SAVE_PAGE_API,
{
pageId: savePageRequest.pageId,
},
);
try {
// Store the updated DSL in the pageDSLs reducer
yield put({
@ -512,22 +474,13 @@ export function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) {
}
yield put(setLastUpdatedTime(Date.now() / 1000));
yield put(savePageSuccess(savePageResponse));
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.SAVE_PAGE_API,
);
checkAndLogErrorsIfCyclicDependency(
(savePageResponse.data as SavePageResponseData)
.layoutOnLoadActionErrors,
);
}
} catch (error) {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.SAVE_PAGE_API,
{
failed: true,
},
);
if (error instanceof UserCancelledActionExecutionError) {
return;
}

View File

@ -42,9 +42,6 @@ import {
} from "actions/userActions";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { INVITE_USERS_TO_WORKSPACE_FORM } from "ee/constants/forms";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import type { User } from "constants/userConstants";
import { ANONYMOUS_USERNAME } from "constants/userConstants";
import {
@ -154,9 +151,6 @@ export function* getCurrentUserSaga(action?: {
}) {
const userProfile = action?.payload?.userProfile;
try {
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.USER_ME_API,
);
const response: ApiResponse = yield call(
getFromServerWhenNoPrefetchedResult,
userProfile,
@ -172,10 +166,6 @@ export function* getCurrentUserSaga(action?: {
});
}
} catch (error) {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.USER_ME_API,
{ failed: true },
);
yield put({
type: ReduxActionErrorTypes.FETCH_USER_DETAILS_ERROR,
payload: {
@ -237,8 +227,6 @@ export function* runUserSideEffectsSaga() {
if (currentUser.emptyInstance) {
history.replace(SETUP);
}
PerformanceTracker.stopAsyncTracking(PerformanceTransactionName.USER_ME_API);
}
export function* forgotPasswordSaga(

View File

@ -1,7 +1,4 @@
import React from "react";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { INTEGRATION_TABS } from "constants/routes";
import { getQueryParams } from "utils/URLUtils";
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
@ -42,11 +39,6 @@ function CloseEditor() {
}
const handleClose = () => {
PerformanceTracker.startTracking(
PerformanceTransactionName.CLOSE_SIDE_PANE,
{ path: location.pathname },
);
// if it is a generate CRUD page flow from which user came here
// then route user back to `/generate-page/form`
// else go back to BUILDER_PAGE

View File

@ -17,9 +17,6 @@ import BetaCard from "../BetaCard";
import type { NavigationData } from "selectors/navigationSelectors";
import type { AIEditorContext } from "ee/components/editorComponents/GPT";
import type { EntityTypeValue } from "ee/entities/DataTree/types";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import history, { NavigationMethod } from "utils/history";
import type { Plugin } from "api/PluginApi";
import { EDIT, createMessage } from "ee/constants/messages";
@ -224,9 +221,7 @@ export function Command(props: {
(event) => {
event.stopPropagation();
if (!props.url) return;
PerformanceTracker.startTracking(PerformanceTransactionName.OPEN_ACTION, {
url: props.url,
});
history.push(props.url, { invokedBy: NavigationMethod.SlashCommandHint });
AnalyticsUtil.logEvent("EDIT_ACTION_CLICK", props.eventParams || {});
},

View File

@ -10,9 +10,6 @@ import React, {
} from "react";
import { useDispatch, useSelector } from "react-redux";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { updateExplorerWidthAction } from "actions/explorerActions";
import {
getExplorerActive,
@ -73,10 +70,6 @@ export const EntityExplorerSidebar = memo(({ children }: Props) => {
const resizer = useHorizontalResize(sidebarRef, onWidthChange, onDragEnd);
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
PerformanceTracker.startTracking(PerformanceTransactionName.SIDE_BAR_MOUNT);
useEffect(() => {
PerformanceTracker.stopTracking();
});
/**
* on hover of resizer, show tooltip

View File

@ -3,9 +3,6 @@ import * as Sentry from "@sentry/react";
import { useSelector } from "react-redux";
import React, { memo, useContext, useEffect, useMemo, useRef } from "react";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { getSelectedWidgets } from "selectors/ui";
import { tailwindLayers } from "constants/Layers";
import WidgetPropertyPane from "pages/Editor/PropertyPane";
@ -75,11 +72,6 @@ export const PropertyPaneSidebar = memo((props: Props) => {
prevSelectedWidgetId.current =
selectedWidgetIds.length === 1 ? selectedWidgetIds[0] : undefined;
PerformanceTracker.startTracking(PerformanceTransactionName.SIDE_BAR_MOUNT);
useEffect(() => {
PerformanceTracker.stopTracking();
});
/**
* renders the property pane:
* 2. if no widget is selected -> CanvasPropertyPane

View File

@ -36,9 +36,6 @@ import {
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import history from "utils/history";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import type { AppEnginePayload } from ".";
import AppEngine, {
ActionsNotFoundError,
@ -107,18 +104,6 @@ export default class AppEditorEngine extends AppEngine {
endSpan(editorSetupSpan);
}
public startPerformanceTracking() {
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.INIT_EDIT_APP,
);
}
public stopPerformanceTracking() {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.INIT_EDIT_APP,
);
}
private *loadPageThemesAndActions(
toLoadPageId: string,
applicationId: string,

View File

@ -18,9 +18,6 @@ import {
reportSWStatus,
waitForWidgetConfigBuild,
} from "sagas/InitSagas";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import type { AppEnginePayload } from ".";
import AppEngine, { ActionsNotFoundError } from ".";
import { fetchJSLibraries } from "actions/JSLibraryActions";
@ -77,18 +74,6 @@ export default class AppViewerEngine extends AppEngine {
endSpan(viewerSetupSpan);
}
startPerformanceTracking() {
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.INIT_VIEW_APP,
);
}
stopPerformanceTracking() {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.INIT_VIEW_APP,
);
}
*loadAppEntities(
toLoadPageId: string,
applicationId: string,

View File

@ -78,8 +78,6 @@ export default abstract class AppEngine {
rootSpan: Span,
): any;
abstract loadGit(applicationId: string, rootSpan: Span): any;
abstract startPerformanceTracking(): any;
abstract stopPerformanceTracking(): any;
abstract completeChore(rootSpan: Span): any;
/* eslint-enable @typescript-eslint/no-explicit-any */

View File

@ -40,9 +40,6 @@ import {
ResponsiveBehavior,
} from "layoutSystems/common/utils/constants";
import { useReflow } from "utils/hooks/useReflow";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import WidgetFactory from "WidgetProvider/factory";
import { isDropZoneOccupied } from "utils/WidgetPropsUtils";
import { isFunction } from "lodash";
@ -92,16 +89,7 @@ function AutoLayoutResizableComponent(props: ResizableProps) {
occupiedSpacesBySiblingWidgets,
);
};
// Performance tracking start
const sentryPerfTags = props.zWidgetType
? [{ name: "widget_type", value: props.zWidgetType }]
: [];
PerformanceTracker.startTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
{ widgetId: props.zWidgetId },
true,
sentryPerfTags,
);
const reflowSelector = getReflowSelector(props.widgetId);
const equal = (
@ -126,11 +114,6 @@ function AutoLayoutResizableComponent(props: ResizableProps) {
false,
);
useEffect(() => {
PerformanceTracker.stopTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
);
}, []);
//end
const [pointerEvents, togglePointerEvents] = useState(true);
const [newDimensions, set] = useState<DimensionUpdateProps>({

View File

@ -9,9 +9,6 @@ import {
ResizeWrapper,
} from "layoutSystems/common/resizer/common";
import type { StyledComponent } from "styled-components";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
const getSnappedValues = (
x: number,
@ -103,23 +100,6 @@ interface ResizableProps {
}
export function ModalResizable(props: ResizableProps) {
// Performance tracking start
const sentryPerfTags = props.zWidgetType
? [{ name: "widget_type", value: props.zWidgetType }]
: [];
PerformanceTracker.startTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
{ widgetId: props.widgetId },
true,
sentryPerfTags,
);
useEffect(() => {
PerformanceTracker.stopTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
);
});
//end
const [pointerEvents, togglePointerEvents] = useState(true);
const [newDimensions, set] = useState({
width: props.componentWidth,

View File

@ -15,9 +15,6 @@ import {
import { getIsTableFilterPaneVisible } from "selectors/tableFilterSelectors";
import styled from "styled-components";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import WidgetFactory from "WidgetProvider/factory";
import { useShowTableFilterPane } from "utils/hooks/dragResizeHooks";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
@ -113,12 +110,6 @@ export function WidgetNameComponent(props: WidgetNameComponentProps) {
}),
);
} else if (!isActiveInPropertyPane) {
PerformanceTracker.startTracking(
PerformanceTransactionName.OPEN_PROPERTY_PANE,
{ widgetId: props.widgetId },
true,
[{ name: "widget_type", value: props.type }],
);
AnalyticsUtil.logEvent("PROPERTY_PANE_OPEN_CLICK", {
widgetType: props.type,
widgetId: props.widgetId,

View File

@ -20,9 +20,6 @@ import { getWidgetByID } from "sagas/selectors";
import { ReflowDirection } from "reflow/reflowTypes";
import { getContainerOccupiedSpacesSelectorWhileResizing } from "selectors/editorSelectors";
import { getReflowSelector } from "selectors/widgetReflowSelectors";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { isDropZoneOccupied } from "utils/WidgetPropsUtils";
import { useReflow } from "utils/hooks/useReflow";
@ -44,16 +41,7 @@ export function FixedLayoutResizable(props: ResizableProps) {
occupiedSpacesBySiblingWidgets,
);
};
// Performance tracking start
const sentryPerfTags = props.zWidgetType
? [{ name: "widget_type", value: props.zWidgetType }]
: [];
PerformanceTracker.startTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
{ widgetId: props.zWidgetId },
true,
sentryPerfTags,
);
const reflowSelector = getReflowSelector(props.widgetId);
const equal = (
@ -78,12 +66,6 @@ export function FixedLayoutResizable(props: ResizableProps) {
);
const widget = useSelector(getWidgetByID(props.widgetId));
useEffect(() => {
PerformanceTracker.stopTracking(
PerformanceTransactionName.SHOW_RESIZE_HANDLES,
);
}, []);
//end
const [pointerEvents, togglePointerEvents] = useState(true);
const dimensionReflectionProps = {
reflectDimension: true,

View File

@ -1,9 +1,6 @@
import React from "react";
import PageLoadingBar from "pages/common/PageLoadingBar";
import { retryPromise } from "utils/AppsmithUtils";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { connect } from "react-redux";
import { showDebugger } from "actions/debuggerActions";
@ -25,7 +22,6 @@ class ApplicationListLoader extends React.PureComponent<any, { Page: any }> {
//Close debugger call is required because if we import the application page with debugger open
//it will cause a debugger to open. issue #21xxx
this.props.closeDebugger();
PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK);
AnalyticsUtil.logEvent("APPLICATIONS_PAGE_LOAD");
retryPromise(
async () =>

View File

@ -22,9 +22,6 @@ import type { CSSProperties } from "styled-components";
import styled from "styled-components";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import { changeApi } from "actions/apiPaneActions";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import * as Sentry from "@sentry/react";
import EntityNotFoundPane from "pages/Editor/EntityNotFoundPane";
import type { ApplicationPayload } from "ee/constants/ReduxActionConstants";
@ -88,9 +85,6 @@ class ApiEditor extends React.Component<Props> {
context!: React.ContextType<typeof ApiEditorContext>;
componentDidMount() {
PerformanceTracker.stopTracking(PerformanceTransactionName.OPEN_ACTION, {
actionType: "API",
});
const type = this.getFormName();
if (this.props.apiId) {
this.props.changeAPIPage(this.props.apiId, type === "SAAS");
@ -109,9 +103,6 @@ class ApiEditor extends React.Component<Props> {
};
componentDidUpdate(prevProps: Props) {
if (prevProps.isRunning && !this.props.isRunning) {
PerformanceTracker.stopTracking(PerformanceTransactionName.RUN_API_CLICK);
}
if (prevProps.apiId !== this.props.apiId) {
const type = this.getFormName();
this.props.changeAPIPage(this.props.apiId || "", type === "SAAS");

View File

@ -29,9 +29,6 @@ import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { ApiEditorContextProvider } from "./ApiEditorContext";
import type { PaginationField } from "api/ActionAPI";
import { get, keyBy } from "lodash";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import ConvertToModuleInstanceCTA from "ee/pages/Editor/EntityEditor/ConvertToModuleInstanceCTA";
import { MODULE_TYPE } from "ee/constants/ModuleConstants";
import Disabler from "pages/common/Disabler";
@ -140,12 +137,6 @@ function ApiEditorWrapper(props: ApiEditorWrapperProps) {
const handleRunClick = useCallback(
(paginationField?: PaginationField) => {
const pluginName = plugins.find((plugin) => plugin.id === pluginId)?.name;
PerformanceTracker.startTracking(
PerformanceTransactionName.RUN_API_CLICK,
{
apiId: action?.id,
},
);
AnalyticsUtil.logEvent("RUN_API_CLICK", {
apiName,
apiID: action?.id,

View File

@ -3,9 +3,6 @@ import { useSelector } from "react-redux";
import Entity, { EntityClassNames } from "../Entity";
import ActionEntityContextMenu from "./ActionEntityContextMenu";
import history, { NavigationMethod } from "utils/history";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import {
getActionByBaseId,
getDatasource,
@ -70,9 +67,6 @@ export const ExplorerActionEntity = memo((props: ExplorerActionEntityProps) => {
const icon = config?.getIcon(action, pluginGroups[action.pluginId]);
const switchToAction = useCallback(() => {
PerformanceTracker.startTracking(PerformanceTransactionName.OPEN_ACTION, {
url,
});
url && history.push(url, { invokedBy: NavigationMethod.EntityExplorer });
AnalyticsUtil.logEvent("ENTITY_EXPLORER_CLICK", {
type: "QUERIES/APIs",

View File

@ -2,9 +2,6 @@ import React, { useCallback, useEffect } from "react";
import EntityProperty from "./EntityProperty";
import { useDispatch, useSelector } from "react-redux";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import * as Sentry from "@sentry/react";
import type { AppState } from "ee/reducers";
import classNames from "classnames";
@ -50,15 +47,6 @@ export function EntityProperties() {
(state: AppState) => state.ui.widgetDragResize.lastSelectedWidget,
);
PerformanceTracker.startTracking(
PerformanceTransactionName.ENTITY_EXPLORER_ENTITY,
);
useEffect(() => {
PerformanceTracker.stopTracking(
PerformanceTransactionName.ENTITY_EXPLORER_ENTITY,
);
});
useEffect(() => {
document.addEventListener("click", handleOutsideClick);
return () => document.removeEventListener("click", handleOutsideClick);

View File

@ -1,9 +1,6 @@
import React, { useRef, useCallback, useEffect } from "react";
import styled from "styled-components";
import { NonIdealState, Classes } from "@blueprintjs/core";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { useDispatch, useSelector } from "react-redux";
import { Colors } from "constants/Colors";
@ -66,10 +63,6 @@ const NoResult = styled(NonIdealState)`
function EntityExplorer({ isActive }: { isActive: boolean }) {
const dispatch = useDispatch();
PerformanceTracker.startTracking(PerformanceTransactionName.ENTITY_EXPLORER);
useEffect(() => {
PerformanceTracker.stopTracking();
});
const explorerRef = useRef<HTMLDivElement | null>(null);
const isFirstTimeUserOnboardingEnabled = useSelector(
getIsFirstTimeUserOnboardingEnabled,

View File

@ -30,9 +30,6 @@ import { PLUGIN_PACKAGE_DBS } from "constants/QueryEditorConstants";
import type { QueryAction, SaaSAction } from "entities/Action";
import Spinner from "components/editorComponents/Spinner";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { initFormEvaluations } from "actions/evaluationActions";
import { getUIComponent } from "./helpers";
@ -149,10 +146,6 @@ class QueryEditor extends React.Component<Props> {
this.props.setActionProperty(this.props.actionId, path, value);
}
}
PerformanceTracker.stopTracking(PerformanceTransactionName.OPEN_ACTION, {
actionType: "QUERY",
});
}
handleDeleteClick = () => {
@ -169,10 +162,7 @@ class QueryEditor extends React.Component<Props> {
const pluginName = this.props.plugins.find(
(plugin) => plugin.id === this.props.pluginId,
)?.name;
PerformanceTracker.startTracking(
PerformanceTransactionName.RUN_QUERY_CLICK,
{ actionId: this.props.actionId },
);
AnalyticsUtil.logEvent("RUN_QUERY_CLICK", {
actionId: this.props.actionId,
dataSourceSize: dataSources.length,
@ -186,11 +176,6 @@ class QueryEditor extends React.Component<Props> {
};
componentDidUpdate(prevProps: Props) {
if (prevProps.isRunning === true && this.props.isRunning === false) {
PerformanceTracker.stopTracking(
PerformanceTransactionName.RUN_QUERY_CLICK,
);
}
// Update the page when the queryID is changed by changing the
// URL or selecting new query from the query pane
// reusing same logic for changing query panes for switching query editor datasources, since the operations are similar.

View File

@ -6,9 +6,6 @@ import {
getCurrentPageName,
} from "selectors/editorSelectors";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
import { WidgetEditorContainer } from "./WidgetEditorContainer";
import { WidgetEditorHeader } from "./WidgetEditorHeader";
@ -27,10 +24,6 @@ function WidgetsEditor() {
const currentPageName = useSelector(getCurrentPageName);
const currentApp = useSelector(getCurrentApplication);
useEffect(() => {
PerformanceTracker.stopTracking(PerformanceTransactionName.CLOSE_SIDE_PANE);
});
useEffect(() => {
if (currentPageName !== undefined && currentPageId !== undefined) {
// Logging page load event
@ -43,7 +36,6 @@ function WidgetsEditor() {
}
}, [currentPageName, currentPageId]);
PerformanceTracker.stopTracking();
return (
<WidgetEditorContainer>
<WidgetEditorHeader />

View File

@ -39,9 +39,6 @@ import {
} from "pages/UserAuth/StyledComponents";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { LOGIN_SUBMIT_PATH } from "ee/constants/ApiConstants";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { getIsSafeRedirectURL } from "utils/helpers";
import { getCurrentUser } from "selectors/usersSelectors";
import Container from "pages/UserAuth/Container";
@ -201,9 +198,6 @@ export function Login(props: LoginFormProps) {
isDisabled={!isFormValid}
kind="primary"
onClick={() => {
PerformanceTracker.startTracking(
PerformanceTransactionName.LOGIN_CLICK,
);
AnalyticsUtil.logEvent("LOGIN_CLICK", {
loginMethod: "EMAIL",
});

View File

@ -39,9 +39,6 @@ import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { SIGNUP_SUBMIT_PATH } from "ee/constants/ApiConstants";
import { connect, useSelector } from "react-redux";
import type { AppState } from "ee/reducers";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { SIGNUP_FORM_EMAIL_FIELD_NAME } from "ee/constants/forms";
import { getAppsmithConfigs } from "ee/configs";
@ -261,9 +258,6 @@ export function SignUp(props: SignUpFormProps) {
AnalyticsUtil.logEvent("SIGNUP_CLICK", {
signupMethod: "EMAIL",
});
PerformanceTracker.startTracking(
PerformanceTransactionName.SIGN_UP,
);
}}
size="md"
type="submit"

View File

@ -5,9 +5,6 @@ import { getSocialLoginButtonProps } from "ee/utils/signupHelpers";
import type { EventName } from "ee/utils/analyticsUtilTypes";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { useLocation } from "react-router-dom";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { Button } from "@appsmith/ads";
import { isTenantConfig } from "ee/utils/adminSettingsHelpers";
import { useSelector } from "react-redux";
@ -63,12 +60,7 @@ function SocialLoginButton(props: {
if (props.type === "SIGNUP") {
eventName = "SIGNUP_CLICK";
}
PerformanceTracker.startTracking(
eventName === "SIGNUP_CLICK"
? PerformanceTransactionName.SIGN_UP
: PerformanceTransactionName.LOGIN_CLICK,
{ name: props.name.toUpperCase() },
);
AnalyticsUtil.logEvent(eventName, {
loginMethod: props.name.toUpperCase(),
});

View File

@ -5,9 +5,6 @@ import { useCallback } from "react";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { getCurrentUser } from "selectors/usersSelectors";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import UserWelcomeScreen from "pages/setup/UserWelcomeScreen";
import { Center } from "pages/setup/common";
import { Spinner } from "@appsmith/ads";
@ -27,7 +24,6 @@ export function SignupSuccess() {
const user = useSelector(getCurrentUser);
useEffect(() => {
PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP);
user?.email && setUserSignedUpFlag(user?.email);
}, []);

View File

@ -72,7 +72,6 @@ import {
extractClientDefinedErrorMetadata,
validateResponse,
} from "sagas/ErrorSagas";
import type { EventName } from "ee/utils/analyticsUtilTypes";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import type { Action } from "entities/Action";
import { ActionExecutionContext } from "entities/Action";
@ -103,9 +102,6 @@ import {
getLayoutOnLoadActions,
getLayoutOnLoadIssues,
} from "selectors/editorSelectors";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import * as log from "loglevel";
import { EMPTY_RESPONSE } from "components/editorComponents/emptyResponse";
import type { AppState } from "ee/reducers";
@ -536,13 +532,6 @@ export default function* executePluginActionTriggerSaga(
getType(params),
);
}
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.EXECUTE_ACTION,
{
actionId: actionId,
},
actionId,
);
setAttributesToSpan(span, {
actionId: actionId,
@ -702,19 +691,9 @@ function* runActionShortcutSaga() {
});
if (!match || !match.params) return;
const { baseApiId, basePageId, baseQueryId } = match.params;
const { baseApiId, baseQueryId } = match.params;
const actionId = baseApiId || baseQueryId;
if (actionId) {
const trackerId = baseApiId
? PerformanceTransactionName.RUN_API_SHORTCUT
: PerformanceTransactionName.RUN_QUERY_SHORTCUT;
PerformanceTracker.startTracking(trackerId, {
actionId,
basePageId,
});
AnalyticsUtil.logEvent(trackerId as EventName, {
actionId,
});
yield put(runAction(actionId));
} else {
return;
@ -1207,13 +1186,6 @@ function* executePageLoadAction(
}),
);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.EXECUTE_ACTION,
{
failed: true,
},
pageAction.id,
);
AnalyticsUtil.logEvent("EXECUTE_ACTION_FAILURE", {
type: pageAction.pluginType,
name: actionName,
@ -1256,11 +1228,6 @@ function* executePageLoadAction(
? actionExecutionContext
: ActionExecutionContext.PAGE_LOAD,
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.EXECUTE_ACTION,
undefined,
pageAction.id,
);
yield take(ReduxActionTypes.SET_EVALUATED_TREE);
}
@ -1282,10 +1249,6 @@ function* executePageLoadActionsSaga(
setAttributesToSpan(span, { numActions: actionCount });
// when cyclical depedency issue is there,
// none of the page load actions would be executed
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.EXECUTE_PAGE_LOAD_ACTIONS,
{ numActions: actionCount },
);
for (const actionSet of pageActions) {
// Load all sets in parallel
// @ts-expect-error: no idea how to type this
@ -1300,9 +1263,6 @@ function* executePageLoadActionsSaga(
),
);
}
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.EXECUTE_PAGE_LOAD_ACTIONS,
);
// We show errors in the debugger once onPageLoad actions
// are executed
yield put(hideDebuggerErrors(false));
@ -1364,13 +1324,7 @@ function* executePluginActionSaga(
throw new UserCancelledActionExecutionError();
}
}
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.EXECUTE_ACTION,
{
actionId: actionId,
},
actionId,
);
yield put(executePluginActionRequest({ id: actionId }));
const appMode: APP_MODE | undefined = yield select(getAppMode);
@ -1415,9 +1369,6 @@ function* executePluginActionSaga(
response = yield ActionAPI.executeAction(formData, timeout, parentSpan);
const isError = isErrorResponse(response);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.EXECUTE_ACTION,
);
yield validateResponse(response);
payload = createActionExecutionResponse(response);

View File

@ -85,9 +85,6 @@ import {
} from "ee/selectors/entitiesSelector";
import history from "utils/history";
import { INTEGRATION_TABS } from "constants/routes";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import {
ACTION_COPY_SUCCESS,
ACTION_MOVE_SUCCESS,
@ -395,10 +392,7 @@ export function* fetchActionsSaga(
action: EvaluationReduxAction<FetchActionsPayload>,
) {
const { applicationId, unpublishedActions } = action.payload;
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
{ mode: "EDITOR", appId: applicationId },
);
try {
const response: ApiResponse<Action[]> = yield call(
getFromServerWhenNoPrefetchedResult,
@ -413,19 +407,12 @@ export function* fetchActionsSaga(
payload: response.data,
postEvalActions: action.postEvalActions,
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
);
}
} catch (error) {
yield put({
type: ReduxActionErrorTypes.FETCH_ACTIONS_ERROR,
payload: { error },
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
{ failed: true },
);
}
}
@ -433,10 +420,7 @@ export function* fetchActionsForViewModeSaga(
action: ReduxAction<FetchActionsPayload>,
) {
const { applicationId, publishedActions } = action.payload;
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
{ mode: "VIEWER", appId: applicationId },
);
try {
const response: ApiResponse<ActionViewMode[]> = yield call(
getFromServerWhenNoPrefetchedResult,
@ -464,18 +448,11 @@ export function* fetchActionsForViewModeSaga(
payload: response.responseMeta.error,
});
}
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
);
} catch (error) {
yield put({
type: ReduxActionErrorTypes.FETCH_ACTIONS_VIEW_MODE_ERROR,
payload: { error },
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_ACTIONS_API,
{ failed: true },
);
}
}
@ -483,10 +460,7 @@ export function* fetchActionsForPageSaga(
action: EvaluationReduxAction<{ pageId: string }>,
) {
const { pageId } = action.payload;
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_ACTIONS_API,
{ pageId: pageId },
);
try {
const response: ApiResponse<Action[]> = yield call(
ActionAPI.fetchActionsByPageId,
@ -495,16 +469,8 @@ export function* fetchActionsForPageSaga(
const isValidResponse: boolean = yield validateResponse(response);
if (isValidResponse) {
yield put(fetchActionsForPageSuccess(response.data));
// wait for success of
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_ACTIONS_API,
);
}
} catch (error) {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.FETCH_PAGE_ACTIONS_API,
{ failed: true },
);
yield put({
type: ReduxActionErrorTypes.FETCH_ACTIONS_FOR_PAGE_ERROR,
payload: { error },
@ -514,11 +480,6 @@ export function* fetchActionsForPageSaga(
export function* updateActionSaga(actionPayload: ReduxAction<{ id: string }>) {
try {
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.UPDATE_ACTION_API,
{ actionid: actionPayload.payload.id },
);
let action: Action = yield select(getAction, actionPayload.payload.id);
if (!action) throw new Error("Could not find action to update");
@ -571,20 +532,12 @@ export function* updateActionSaga(actionPayload: ReduxAction<{ id: string }>) {
pageName,
});
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.UPDATE_ACTION_API,
);
yield put(updateActionSuccess({ data: response.data }));
checkAndLogErrorsIfCyclicDependency(
(response.data as Action).errorReports,
);
}
} catch (error) {
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.UPDATE_ACTION_API,
{ failed: true },
);
yield put({
type: ReduxActionErrorTypes.UPDATE_ACTION_ERROR,
payload: { error, id: actionPayload.payload.id, show: false },
@ -857,12 +810,6 @@ export function* refactorActionName(
oldName: string,
newName: string,
) {
// fetch page of the action
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.REFACTOR_ACTION_NAME,
{ actionId: id },
);
const params: FetchPageRequest = { pageId, migrateDSL: true };
const pageResponse: FetchPageResponse = yield call(PageApi.fetchPage, params);
// check if page request is successful
@ -884,10 +831,6 @@ export function* refactorActionName(
const currentPageId: string = yield select(getCurrentPageId);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.REFACTOR_ACTION_NAME,
{ isSuccess: isRefactorSuccessful },
);
if (isRefactorSuccessful) {
yield put({
type: ReduxActionTypes.SAVE_ACTION_NAME_SUCCESS,

View File

@ -53,9 +53,6 @@ import type {
import { PluginPackageName, PluginType } from "entities/Action";
import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors";
import log from "loglevel";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import type { EventLocation } from "ee/utils/analyticsUtilTypes";
import { createMessage, ERROR_ACTION_RENAME_FAIL } from "ee/constants/messages";
import {
@ -97,7 +94,6 @@ function* syncApiParamsSaga(
//Payload here contains the path and query params of a typical url like https://{domain}/{path}?{query_params}
const value = actionPayload.payload;
// Regular expression to find the query params group
PerformanceTracker.startTracking(PerformanceTransactionName.SYNC_PARAMS_SAGA);
if (field === "actionConfiguration.path") {
const params = parseUrlForQueryParams(value);
// before updating the query parameters make sure the path field changes have been successfully updated first
@ -135,7 +131,6 @@ function* syncApiParamsSaga(
),
);
}
PerformanceTracker.stopTracking();
}
function* handleUpdateBodyContentType(
@ -293,7 +288,6 @@ function* changeApiSaga(
action?: Action;
}>,
) {
PerformanceTracker.startTracking(PerformanceTransactionName.CHANGE_API_SAGA);
const { id, isSaas } = actionPayload.payload;
let { action } = actionPayload.payload;
if (!action) action = yield select(getAction, id);
@ -329,7 +323,6 @@ function* changeApiSaga(
getFormData,
API_EDITOR_FORM_NAME,
);
PerformanceTracker.stopTracking();
yield put(updateReplayEntity(id, actionPostProcess, ENTITY_TYPE.ACTION));
}

View File

@ -31,9 +31,6 @@ import { PropertyEvaluationErrorType } from "utils/DynamicBindingUtils";
import { EVAL_WORKER_ACTIONS } from "ee/workers/Evaluation/evalWorkerActions";
import log from "loglevel";
import type { WidgetProps } from "widgets/BaseWidget";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import * as Sentry from "@sentry/react";
import type { Action } from "redux";
import {
@ -162,13 +159,6 @@ export function* updateDataTreeHandler(
const appMode: ReturnType<typeof getAppMode> = yield select(getAppMode);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.DATA_TREE_EVALUATION,
);
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.SET_EVALUATED_TREE,
);
if (!isEmpty(staleMetaIds)) {
yield put(resetWidgetsMetaState(staleMetaIds));
}
@ -177,10 +167,6 @@ export function* updateDataTreeHandler(
ConfigTreeActions.setConfigTree(configTree);
PerformanceTracker.stopAsyncTracking(
PerformanceTransactionName.SET_EVALUATED_TREE,
);
// if evalMetaUpdates are present only then dispatch updateMetaState
if (evalMetaUpdates.length) {
yield put(updateMetaState(evalMetaUpdates));
@ -267,9 +253,7 @@ export function* evaluateTreeSaga(
const theme: ReturnType<typeof getSelectedAppTheme> =
yield select(getSelectedAppTheme);
log.debug({ unevalTree, configTree: unEvalAndConfigTree.configTree });
PerformanceTracker.startAsyncTracking(
PerformanceTransactionName.DATA_TREE_EVALUATION,
);
const appMode: ReturnType<typeof getAppMode> = yield select(getAppMode);
const widgetsMeta: ReturnType<typeof getWidgetsMeta> =
yield select(getWidgetsMeta);

View File

@ -306,7 +306,6 @@ export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
action.payload.mode,
action.payload.mode,
);
engine.startPerformanceTracking();
yield call(engine.setupEngine, action.payload, rootSpan);
const getInitResponsesSpan = startNestedSpan(
@ -344,7 +343,6 @@ export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
yield call(engine.loadGit, applicationId, rootSpan);
yield call(engine.completeChore, rootSpan);
yield put(generateAutoHeightLayoutTreeAction(true, false));
engine.stopPerformanceTracking();
} catch (e) {
log.error(e);
if (e instanceof AppEngineApiError) return;

View File

@ -1,281 +0,0 @@
import * as Sentry from "@sentry/react";
import type { Span } from "@sentry/tracing";
import { SpanStatus } from "@sentry/tracing";
import { getAppsmithConfigs } from "ee/configs";
import _ from "lodash";
import * as log from "loglevel";
export enum PerformanceTransactionName {
DATA_TREE_EVALUATION = "DATA_TREE_EVALUATION",
SET_EVALUATED_TREE = "SET_EVALUATED_TREE",
EXECUTE_PAGE_LOAD_ACTIONS = "EXECUTE_PAGE_LOAD_ACTIONS",
ENTITY_EXPLORER_ENTITY = "ENTITY_EXPLORER_ENTITY",
ENTITY_EXPLORER = "ENTITY_EXPLORER",
CLOSE_SIDE_PANE = "CLOSE_SIDE_PANE",
OPEN_ACTION = "OPEN_ACTION",
SIDE_BAR_MOUNT = "SIDE_BAR_MOUNT",
EXECUTE_ACTION = "EXECUTE_ACTION",
CHANGE_API_SAGA = "CHANGE_API_SAGA",
SYNC_PARAMS_SAGA = "SYNC_PARAMS_SAGA",
RUN_API_CLICK = "RUN_API_CLICK",
RUN_API_SHORTCUT = "RUN_API_SHORTCUT",
RUN_QUERY_CLICK = "RUN_QUERY_CLICK",
RUN_QUERY_SHORTCUT = "RUN_QUERY_SHORTCUT",
FETCH_ACTIONS_API = "FETCH_ACTIONS_API",
FETCH_PAGE_LIST_API = "FETCH_PAGE_LIST_API",
FETCH_PAGE_ACTIONS_API = "FETCH_PAGE_ACTIONS_API",
FETCH_PAGE_API = "FETCH_PAGE_API",
SAVE_PAGE_API = "SAVE_PAGE_API",
UPDATE_ACTION_API = "UPDATE_ACTION_API",
OPEN_PROPERTY_PANE = "OPEN_PROPERTY_PANE",
REFACTOR_ACTION_NAME = "REFACTOR_ACTION_NAME",
USER_ME_API = "USER_ME_API",
SIGN_UP = "SIGN_UP",
LOGIN_CLICK = "LOGIN_CLICK",
INIT_EDIT_APP = "INIT_EDIT_APP",
INIT_VIEW_APP = "INIT_VIEW_APP",
SHOW_RESIZE_HANDLES = "SHOW_RESIZE_HANDLES",
}
export interface PerfTag {
name: string;
value: string;
}
export interface PerfLog {
sentrySpan: Span;
skipLog?: boolean;
eventName: string;
}
const appsmithConfigs = getAppsmithConfigs();
class PerformanceTracker {
private static perfLogQueue: PerfLog[] = [];
private static perfAsyncMap: Map<string, PerfLog> = new Map();
static startTracking = (
eventName: PerformanceTransactionName,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: any,
skipLog = false,
tags: Array<PerfTag> = [],
) => {
if (appsmithConfigs.sentry.enabled) {
const currentTransaction = Sentry.getCurrentHub()
.getScope()
?.getTransaction();
if (
PerformanceTracker.perfLogQueue.length === 0 &&
currentTransaction !== undefined &&
currentTransaction.status === SpanStatus.Ok
) {
PerformanceTracker.perfLogQueue.push({
sentrySpan: currentTransaction,
skipLog: skipLog,
eventName: eventName,
});
}
if (PerformanceTracker.perfLogQueue.length === 0) {
if (!skipLog) {
log.debug(
PerformanceTracker.generateSpaces(
PerformanceTracker.perfLogQueue.length + 1,
) +
eventName +
" Track Transaction ",
);
}
const newTransaction = Sentry.startTransaction({ name: eventName });
tags.forEach(({ name: tagName, value }) => {
newTransaction.setTag(tagName, value);
});
newTransaction.setData("startData", data);
Sentry.getCurrentHub().configureScope((scope) =>
scope.setSpan(newTransaction),
);
PerformanceTracker.perfLogQueue.push({
sentrySpan: newTransaction,
skipLog: skipLog,
eventName: eventName,
});
} else {
if (!skipLog) {
log.debug(
PerformanceTracker.generateSpaces(
PerformanceTracker.perfLogQueue.length + 1,
) +
eventName +
" Track Span ",
);
}
const currentPerfLog =
PerformanceTracker.perfLogQueue[
PerformanceTracker.perfLogQueue.length - 1
];
const currentRunningSpan = currentPerfLog.sentrySpan;
const span = currentRunningSpan.startChild({
op: eventName,
data: data,
});
PerformanceTracker.perfLogQueue.push({
sentrySpan: span,
skipLog: skipLog,
eventName: eventName,
});
}
}
};
static stopTracking = (
eventName?: PerformanceTransactionName,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: any,
) => {
if (appsmithConfigs.sentry.enabled) {
if (eventName) {
const index = _.findLastIndex(
PerformanceTracker.perfLogQueue,
(perfLog) => {
return perfLog.eventName === eventName;
},
);
if (index !== -1) {
for (
let i = PerformanceTracker.perfLogQueue.length - 1;
i >= index;
i--
) {
const perfLog = PerformanceTracker.perfLogQueue.pop();
if (perfLog) {
const currentSpan = perfLog.sentrySpan;
currentSpan.finish();
if (!perfLog?.skipLog) {
PerformanceTracker.printDuration(
perfLog.eventName,
i + 1,
currentSpan.startTimestamp,
currentSpan.endTimestamp,
);
}
}
}
}
} else {
const perfLog = PerformanceTracker.perfLogQueue.pop();
if (perfLog) {
const currentRunningSpan = perfLog?.sentrySpan;
currentRunningSpan.setData("endData", data);
currentRunningSpan.finish();
if (!perfLog?.skipLog) {
PerformanceTracker.printDuration(
perfLog.eventName,
PerformanceTracker.perfLogQueue.length + 1,
currentRunningSpan.startTimestamp,
currentRunningSpan.endTimestamp,
);
}
}
}
}
};
static startAsyncTracking = (
eventName: PerformanceTransactionName,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: any,
uniqueId?: string,
parentEventId?: string,
skipLog = false,
) => {
if (!skipLog) {
log.debug(
"Async " +
PerformanceTracker.generateSpaces(0) +
eventName +
" Track Transaction ",
);
}
if (!parentEventId) {
const newTransaction = Sentry.startTransaction({ name: eventName });
newTransaction.setData("startData", data);
PerformanceTracker.perfAsyncMap.set(uniqueId ? uniqueId : eventName, {
sentrySpan: newTransaction,
eventName: eventName,
skipLog: skipLog,
});
} else {
const perfLog = PerformanceTracker.perfAsyncMap.get(parentEventId);
const childSpan = perfLog?.sentrySpan.startChild({
op: eventName,
data: data,
});
if (childSpan) {
PerformanceTracker.perfAsyncMap.set(uniqueId ? uniqueId : eventName, {
sentrySpan: childSpan,
eventName: eventName,
skipLog: skipLog,
});
}
}
};
static stopAsyncTracking(
eventName: PerformanceTransactionName,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: any,
uniqueId?: string,
) {
const perfLog = PerformanceTracker.perfAsyncMap.get(
uniqueId ? uniqueId : eventName,
);
if (perfLog) {
const currentSpan = perfLog.sentrySpan;
currentSpan.setData("endData", data);
currentSpan.finish();
if (!perfLog?.skipLog) {
PerformanceTracker.printDuration(
perfLog.eventName,
0,
currentSpan.startTimestamp,
currentSpan.endTimestamp,
true,
);
}
}
}
static generateSpaces(num: number) {
let str = "";
for (let i = 0; i < num; i++) {
str += "\t";
}
return str;
}
static printDuration(
eventName: string,
level: number,
startTime: number,
endTime?: number,
isAsync?: boolean,
) {
const duration = ((endTime || 0) - startTime) * 1000;
const spaces = PerformanceTracker.generateSpaces(level);
log.debug(
(isAsync ? "Async " : "") +
spaces +
eventName +
" Finish Tracking in " +
duration +
"ms",
);
}
}
export default PerformanceTracker;

View File

@ -8473,19 +8473,6 @@ __metadata:
languageName: node
linkType: hard
"@sentry/tracing@npm:^6.2.4":
version: 6.2.4
resolution: "@sentry/tracing@npm:6.2.4"
dependencies:
"@sentry/hub": 6.2.4
"@sentry/minimal": 6.2.4
"@sentry/types": 6.2.4
"@sentry/utils": 6.2.4
tslib: ^1.9.3
checksum: 74fb1cf110e10fda9b5eac1c7e0eb92204311d336bcd30642a33fde3a3a0fd73ed8d13ea62e744059adf6bb84d638ec5a35e8d2b40af2f5ff3131c0fb70017a5
languageName: node
linkType: hard
"@sentry/types@npm:6.2.4":
version: 6.2.4
resolution: "@sentry/types@npm:6.2.4"
@ -13197,7 +13184,6 @@ __metadata:
"@react-types/shared": ^3.23.0
"@redux-saga/testing-utils": ^1.1.5
"@sentry/react": ^6.2.4
"@sentry/tracing": ^6.2.4
"@sentry/webpack-plugin": ^1.18.9
"@shared/ast": "workspace:^"
"@shared/dsl": "workspace:^"