Skip to content

Commit

Permalink
fix: revert execution instrumentation (appsmithorg#25163)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohansFavour authored Jul 6, 2023
1 parent 16d21ed commit 3df0252
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 308 deletions.
38 changes: 12 additions & 26 deletions app/client/src/sagas/EvalWorkerActionSagas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { all, call, fork, put, spawn, take } from "redux-saga/effects";
import { all, call, put, spawn, take } from "redux-saga/effects";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { MAIN_THREAD_ACTION } from "@appsmith/workers/Evaluation/evalWorkerActions";
import log from "loglevel";
Expand Down Expand Up @@ -30,16 +30,11 @@ import isEmpty from "lodash/isEmpty";
import type { UnEvalTree } from "entities/DataTree/dataTreeFactory";
import { sortJSExecutionDataByCollectionId } from "workers/Evaluation/JSObject/utils";
import type { LintTreeSagaRequestData } from "plugins/Linting/types";
import AnalyticsUtil from "utils/AnalyticsUtil";
export type UpdateDataTreeMessageData = {
workerResponse: EvalTreeResponseData;
unevalTree: UnEvalTree;
};
import { logJSActionExecution } from "./analyticsSaga";
import { uniq } from "lodash";
import type {
TriggerKind,
TriggerSource,
} from "constants/AppsmithActionConstants/ActionConstants";

export function* handleEvalWorkerRequestSaga(listenerChannel: Channel<any>) {
while (true) {
Expand Down Expand Up @@ -111,27 +106,18 @@ export function* processTriggerHandler(message: any) {
if (messageType === MessageType.REQUEST)
yield call(evalWorker.respond, message.messageId, result);
}
export function* handleJSExecutionLog(
data: TMessage<{
data: {
jsFnFullName: string;
isSuccess: boolean;
triggerMeta: {
source: TriggerSource;
triggerPropertyName: string | undefined;
triggerKind: TriggerKind | undefined;
};
}[];
}>,
) {
export function* handleJSExecutionLog(data: TMessage<{ data: string[] }>) {
const {
body: { data: executionData },
body: { data: executedFns },
} = data;
const executedFns = uniq(
executionData.map((execData) => execData.jsFnFullName),
);
yield fork(logJSActionExecution, executionData);
yield call(logJSFunctionExecution, executedFns);

for (const executedFn of executedFns) {
AnalyticsUtil.logEvent("EXECUTE_ACTION", {
type: "JS",
name: executedFn,
});
}
yield call(logJSFunctionExecution, data);
}

export function* handleEvalWorkerMessage(message: TMessage<any>) {
Expand Down
7 changes: 1 addition & 6 deletions app/client/src/sagas/EvaluationsSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ import { handleEvalWorkerRequestSaga } from "./EvalWorkerActionSagas";
import { getAppsmithConfigs } from "@appsmith/configs";
import { executeJSUpdates } from "actions/pluginActionActions";
import { setEvaluatedActionSelectorField } from "actions/actionSelectorActions";
import { logDynamicTriggerExecution } from "./analyticsSaga";

const APPSMITH_CONFIGS = getAppsmithConfigs();

Expand Down Expand Up @@ -313,6 +312,7 @@ export function* evaluateAndExecuteDynamicTrigger(
const unEvalTree: ReturnType<typeof getUnevaluatedDataTree> = yield select(
getUnevaluatedDataTree,
);
// const unEvalTree = unEvalAndConfigTree.unEvalTree;
log.debug({ execute: dynamicTrigger });
const response: { errors: EvaluationError[]; result: unknown } = yield call(
evalWorker.request,
Expand All @@ -328,11 +328,6 @@ export function* evaluateAndExecuteDynamicTrigger(
);
const { errors = [] } = response as any;
yield call(dynamicTriggerErrorHandler, errors);
yield fork(logDynamicTriggerExecution, {
dynamicTrigger,
errors,
triggerMeta,
});
return response;
}

Expand Down
224 changes: 0 additions & 224 deletions app/client/src/sagas/analyticsSaga.ts

This file was deleted.

18 changes: 0 additions & 18 deletions app/client/src/selectors/entitiesSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,24 +487,6 @@ export const getJSCollectionFromName = createSelector(
return currentJSCollection;
},
);
export const getJSActionFromName = createSelector(
[
(state: AppState, jsCollectionName: string) =>
getJSCollectionFromName(state, jsCollectionName),
(_state: AppState, jsCollectionName: string, functionName: string) => ({
jsCollectionName,
functionName,
}),
],
(JSCollectionData, { functionName }) => {
if (!JSCollectionData) return null;
const jsFunction = find(
JSCollectionData.config.actions,
(action) => action.name === functionName,
);
return jsFunction || null;
},
);

export const getJSActionFromJSCollection = (
JSCollection: JSCollectionData,
Expand Down
7 changes: 7 additions & 0 deletions app/client/src/workers/Evaluation/JSObject/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
ConfigTree,
DataTree,
AppsmithEntity,
DataTreeEntity,
} from "entities/DataTree/dataTreeFactory";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
Expand All @@ -21,6 +22,7 @@ import {
isJSAction,
} from "@appsmith/workers/Evaluation/evaluationUtils";
import JSObjectCollection from "./Collection";
import type { APP_MODE } from "entities/App";
import type {
JSActionEntityConfig,
JSActionEntity,
Expand Down Expand Up @@ -270,6 +272,11 @@ export function isJSObjectVariable(
);
}

export function getAppMode(dataTree: DataTree) {
const appsmithObj = dataTree.appsmith as AppsmithEntity;
return appsmithObj.mode as APP_MODE;
}

export function isPromise(value: any): value is Promise<unknown> {
return Boolean(value && typeof value.then === "function");
}
Expand Down
Loading

0 comments on commit 3df0252

Please sign in to comment.