Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add isModuleInstance property to EXECUTE_ACTION event #37191

Closed
wants to merge 2 commits into from

Conversation

ashit-rath
Copy link
Contributor

@ashit-rath ashit-rath commented Nov 4, 2024

Description

Update 'EXECUTE_ACTION' event to include isModuleInstance property

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

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11658289069
Commit: 4e2d9a8
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js
List of identified flaky tests.
Mon, 04 Nov 2024 06:28:25 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced analytics logging for dynamic trigger executions, now capturing additional details such as isModuleInstance.
    • Improved retrieval of user and application details, including instanceId and pageId.
  • Bug Fixes

    • Removed unnecessary conditional check in the logging function, streamlining event logging.

@ashit-rath ashit-rath self-assigned this Nov 4, 2024
Copy link
Contributor

coderabbitai bot commented Nov 4, 2024

Walkthrough

The changes in the pull request enhance the analyticsSaga.ts file by improving the functionality for retrieving user and application details, as well as logging dynamic trigger executions. Notable modifications include the addition of an import statement and the introduction of new variables for JS collection retrieval. The logging process now captures more detailed information, including whether the JS collection has a module instance ID, while simplifying the control flow by removing a conditional check.

Changes

File Path Change Summary
app/client/src/ce/sagas/analyticsSaga.ts - Added import for getAllJSCollections.
- Introduced jsCollectionsData, jsCollectionData, and jsCollection variables.
- Updated logDynamicTriggerExecution to include isModuleInstance in logs.
- Removed conditional check for triggerMeta.triggerKind.

Possibly related PRs

Suggested labels

IDE Product, Task

Suggested reviewers

  • ankitakinger
  • hetunandu

Poem

In the realm of code where functions play,
New logs and details brighten the day.
With jsCollection now in the mix,
Analytics dance with a few clever tricks.
Triggering events, both big and small,
Capturing data, we’re ready for all! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ashit-rath ashit-rath added the ok-to-test Required label for CI label Nov 4, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Nov 4, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
app/client/src/ce/sagas/analyticsSaga.ts (2)

76-79: Consider combining selectors for performance

The pattern of selecting both widget and jsCollection using the same ID could be optimized into a single selector.

Consider creating a combined selector:

const getSourceDetails = createSelector(
  [getWidget, getJSCollection],
  (widget, jsCollection) => ({ widget, jsCollection })
);

105-105: Extract repeated isModuleInstance calculation

The isModuleInstance calculation is duplicated. Consider extracting it to a constant.

+ const isModuleInstance = Boolean(jsCollection?.moduleInstanceId);
  AnalyticsUtil.logEvent("EXECUTE_ACTION", {
    // ... other properties ...
-   isModuleInstance: Boolean(jsCollection?.moduleInstanceId),
+   isModuleInstance,
  });

  AnalyticsUtil.logEvent(
    isUnsuccessfulExecution
      ? "EXECUTE_ACTION_FAILURE"
      : "EXECUTE_ACTION_SUCCESS",
    {
      // ... other properties ...
-     isModuleInstance: Boolean(jsCollection?.moduleInstanceId),
+     isModuleInstance,
    },
  );

Also applies to: 131-131

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f2c3125 and fba50e9.

📒 Files selected for processing (1)
  • app/client/src/ce/sagas/analyticsSaga.ts (4 hunks)
🔇 Additional comments (2)
app/client/src/ce/sagas/analyticsSaga.ts (2)

9-9: LGTM: Import addition follows existing patterns


Line range hint 76-131: Verify analytics event property consistency

Let's ensure other module-related analytics events also track the isModuleInstance property.

✅ Verification successful

Based on the search results, I can see that the isModuleInstance property is being consistently used in analytics events for action execution in the codebase. The property is added to both success and failure events (EXECUTE_ACTION, EXECUTE_ACTION_SUCCESS, EXECUTE_ACTION_FAILURE) for JS expressions. This shows proper analytics tracking for module-related executions.

Analytics property consistency verified

The implementation correctly tracks module instance information across all relevant analytics events in the action execution flow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other analytics events that might need the isModuleInstance property
rg "AnalyticsUtil\.logEvent.*module" --type ts

Length of output: 48


Script:

#!/bin/bash
# Let's search for all analytics events in the codebase
rg "AnalyticsUtil\.logEvent" -A 5 --type ts

Length of output: 222415


Script:

#!/bin/bash
# Let's also check for any module-related code patterns
ast-grep --pattern 'moduleInstanceId'

Length of output: 37


Script:

#!/bin/bash
# Search for any module-related analytics events with a broader pattern
rg "logEvent.*module|module.*logEvent" --type ts

Length of output: 50

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fba50e9 and 4e2d9a8.

📒 Files selected for processing (1)
  • app/client/src/ce/sagas/analyticsSaga.ts (4 hunks)
🔇 Additional comments (2)
app/client/src/ce/sagas/analyticsSaga.ts (2)

9-9: LGTM: Import statement is correctly placed and necessary

The new import aligns with the implementation requirements.


107-107: LGTM: Analytics property addition is consistent and type-safe

The isModuleInstance property is correctly implemented with proper type coercion and null safety.

Let's verify that this property is handled correctly in analytics:

Also applies to: 133-133

✅ Verification successful

Analytics property addition verified and properly integrated

The isModuleInstance property is correctly implemented in the analytics events:

  • Present in both EXECUTE_ACTION and EXECUTE_ACTION_SUCCESS/FAILURE events
  • Consistently uses Boolean constructor for type coercion
  • Events are properly defined in analyticsUtilTypes.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if analytics utilities properly handle this new property
rg -l "EXECUTE_ACTION" --type ts

Length of output: 300


Script:

#!/bin/bash
# Check analytics event type definitions and handling
rg "EXECUTE_ACTION" app/client/src/ce/utils/analyticsUtilTypes.ts -A 5

# Check analytics saga implementation
rg "isModuleInstance" app/client/src/ce/sagas/analyticsSaga.ts -A 5

# Look for any other usages of isModuleInstance in analytics context
rg "isModuleInstance.*analytics" --type ts

Length of output: 826

app/client/src/ce/sagas/analyticsSaga.ts Show resolved Hide resolved
@ashit-rath
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Nov 4, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/11658967753.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37191.
recreate: .

Copy link

github-actions bot commented Nov 4, 2024

Deploy-Preview-URL: https://ce-37191.dp.appsmith.com

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Nov 11, 2024
Copy link

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant