Skip to content

feat: added properties for executeAction mixpanel event (#35291)#35645

Merged
NilanshBansal merged 7 commits intoreleasefrom
feat/issue-35291/added-mixpanel-properties-executeAction
Aug 14, 2024
Merged

feat: added properties for executeAction mixpanel event (#35291)#35645
NilanshBansal merged 7 commits intoreleasefrom
feat/issue-35291/added-mixpanel-properties-executeAction

Conversation

@NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented Aug 13, 2024

Description

This PR adds new properties to the Execute Action mixpanel event so that we can measure the following:

  • How many users are progressing through their app building journey
  • Are we noticing patterns of what order users are building out this functionality
  • What stage do users get to before they get stuck, or lost

New Properties added are:

  • ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP
  • ACTION_EXECUTION_INVERT_PARAMETER_MAP
  • ACTION_EXECUTION_RAW_QUERY

Fixes #35291

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10372829069
Commit: e8d8a02
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Tue, 13 Aug 2024 16:11:44 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced new constants for action execution parameters, enhancing clarity and maintainability.
    • Added the capability to log raw action configurations in analytics events for improved tracking of action executions.
  • Improvements

    • Enhanced analytics data handling by conditionally managing properties based on the hosting environment, ensuring better data privacy for self-hosted applications.
    • Expanded functionality of action execution by integrating new configuration options, improving overall performance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Walkthrough

The recent changes enhance the application’s action execution capabilities by introducing new constants for managing parameters and refining the analytics event logging process. A new rawActionConfiguration parameter improves the tracking of user queries, while modifications to the analytics service ensure that sensitive data is handled appropriately based on whether the application is self-hosted.

Changes

Files Change Summary
app/.../FieldNameCE.java Added three public constants: ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP, ACTION_EXECUTION_INVERT_PARAMETER_MAP, and ACTION_CONFIGURATION.
app/.../AnalyticsServiceCEImpl.java Modified sendEvent method to conditionally exclude ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP for self-hosted environments, enhancing data privacy.
app/.../ActionExecutionSolutionCEImpl.java Updated sendExecuteAnalyticsEvent method to include a new rawActionConfiguration parameter, enriching analytics tracking by capturing raw execution data.
app/.../ActionExecutionSolutionImpl.java Enhanced constructor to accept a CommonConfig parameter, allowing for new configuration options during action execution.
app/.../ActionExecutionSolutionCEImplTest.java Introduced a mocked CommonConfig dependency in tests to ensure isolation and control over configuration behavior.

Assessment against linked issues

Objective Addressed Explanation
Include the request parameter for all execute action events (##35291) The request parameter has not been added in this update.
Add a new property which shows all the parameters (##35291) No changes were made to include an array of parameters.
Have a new property which shows the raw query without the substitutions (##35291) The rawActionConfiguration was successfully added.

🎉 In the realm of code, changes take flight,
New constants and queries, shining so bright.
Analytics refined, with data in sight,
Action execution guided by logic and light.
Embrace these updates, let progress ignite! ✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@github-actions github-actions bot added Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Product Issues related to a specific integration Query & JS Pod Issues related to the query & JS Pod Task A simple Todo Enhancement New feature or request labels Aug 13, 2024
@NilanshBansal NilanshBansal requested a review from sneha122 August 13, 2024 04:21
@NilanshBansal NilanshBansal marked this pull request as ready for review August 13, 2024 04:25
@NilanshBansal NilanshBansal self-assigned this Aug 13, 2024
@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label Aug 13, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31be835 and 3f64cfd.

Files selected for processing (3)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (4 hunks)
Additional context used
Learnings (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1)
Learnt from: abhvsn
PR: appsmithorg/appsmith#33894
File: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java:256-258
Timestamp: 2024-05-31T13:06:01.938Z
Learning: Different values for `EMAIL_DOMAIN_HASH` and `ADMIN_EMAIL_DOMAIN_HASH` are used in events to facilitate granular filtering on third-party services.
Additional comments not posted (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1)

154-156: Great job adding new constants!

The new constants ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP, ACTION_EXECUTION_INVERT_PARAMETER_MAP, and ACTION_EXECUTION_RAW_QUERY are well-named and consistent with the existing naming conventions in the class. These additions will help improve the clarity and maintainability of the code. Ensure these constants are used appropriately in the application to avoid any unused code.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1)

210-212: Well done on enhancing data privacy!

The conditional check to remove ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP from analyticsProperties for self-hosted instances is a thoughtful addition. This change aligns with best practices for data privacy and ensures that sensitive data is not unnecessarily exposed.

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (3)

792-792: Good addition of the rawQuery parameter!

Including the rawQuery in the analytics data provides valuable insights into user queries and helps in understanding user behavior better. Ensure that this parameter is correctly populated and used throughout the application to maximize its utility.


1123-1129: Nice work on enriching analytics data!

The inclusion of ACTION_EXECUTION_REQUEST_PARAMS_VALUE_MAP, ACTION_EXECUTION_INVERT_PARAMETER_MAP, and ACTION_EXECUTION_RAW_QUERY in the analytics data enriches the context available for analysis. This will help in tracking user interactions more effectively.


828-833: Ensure consistency in method signatures.

The addition of the rawQuery parameter to the sendExecuteAnalyticsEvent method is consistent with the goal of enhancing analytics data. Verify that all calls to this method are updated to include the new parameter to avoid any runtime issues.

Verification successful

Consistency in Method Signatures Verified

The sendExecuteAnalyticsEvent method has been updated to include the rawQuery parameter, and all calls to this method within the codebase are consistent with this change. There are no other calls outside the ActionExecutionSolutionCEImpl.java file.

  • The method signature and its usage are consistent with the addition of the rawQuery parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all calls to `sendExecuteAnalyticsEvent` include the new `rawQuery` parameter.

# Test: Search for the method usage. Expect: All occurrences include the `rawQuery` parameter.
rg --type java -A 2 $'sendExecuteAnalyticsEvent('

Length of output: 153


Script:

#!/bin/bash
# Correcting the regex pattern to search for the method usage and verify all occurrences include the `rawQuery` parameter.
rg --type java -A 5 'sendExecuteAnalyticsEvent\('

Length of output: 2021


Script:

#!/bin/bash
# Search for the method signature of `sendExecuteAnalyticsEvent` to verify the presence of the `rawQuery` parameter.
rg --type java -A 10 'sendExecuteAnalyticsEvent\('

Length of output: 3410


Script:

#!/bin/bash
# Search for all occurrences of the `sendExecuteAnalyticsEvent` method across the codebase to ensure consistency.
rg --type java 'sendExecuteAnalyticsEvent\('

Length of output: 398

if (shouldHashUserId(event, userId, hashUserId, commonConfig.isCloudHosting())) {
final String hashedUserId = hash(userId);
analyticsProperties.remove("request");
// Remove params map key property if it's self-hosted
Copy link
Contributor

Choose a reason for hiding this comment

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

@NilanshBansal Why are we removing this for self hosted? Can we please let the comment also reflect why we are doing this?

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f64cfd and bb3c7f1.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bb3c7f1 and 13960e0.

Files selected for processing (4)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ActionExecutionSolutionImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (11 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java
Additional comments not posted (4)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ActionExecutionSolutionImpl.java (2)

4-4: The import statement for CommonConfig looks good!

The addition of this import is necessary for the new configuration dependency.


42-43: Constructor changes look good!

The inclusion of CommonConfig enhances the class's ability to manage configurations effectively.

However, ensure that this change is reflected in all places where this class is instantiated.

Also applies to: 62-63

app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (2)

132-134: The addition of @MockBean for CommonConfig is well done!

This allows for effective testing without relying on the actual configuration implementation.


164-165: The beforeEach method update looks good!

Including commonConfig ensures that the mock is utilized during test execution.

Consider verifying that all relevant tests cover the use of CommonConfig.

Verification successful

Test Coverage for CommonConfig is Adequate

The commonConfig is utilized in multiple test files, indicating that its functionality is well-covered across different scenarios. This ensures that the mock configuration is effectively tested.

  • Files with coverage:
    • ProductAlertServiceCEImplTest
    • UserIdentifierServiceCEImplTest
    • UserServiceTest

The update to include commonConfig in the beforeEach method is well-supported by these tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test coverage for `CommonConfig`.

# Test: Search for test methods using `commonConfig`. Expect: Relevant tests cover its usage.
rg --type java '@Test' -A 5 | rg 'commonConfig'

Length of output: 2372

@NilanshBansal NilanshBansal requested a review from sneha122 August 13, 2024 14:46
sneha122
sneha122 previously approved these changes Aug 13, 2024
@github-actions
Copy link

Failed server tests

  • com.appsmith.server.services.ce.ThemeImportableServiceCETest#importThemesToApplication_WhenBothImportedThemesAreCustom_NewThemesCreated
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testEnrichExecutionParams_withBlobReference_performsSubstitutionCorrectly
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithParameterMapAsLastPart
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithUsualOrderingOfTheParts
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withMalformedExecuteActionDTO_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutActionId_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutExecuteActionDTOPart_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testParsePartsAndGetParamsFlux_withBlobIdentifiers_replacesValueInParam
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCETest#testActionExecuteSecondaryStaleConnection

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testEnrichExecutionParams_withBlobReference_performsSubstitutionCorrectly
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithParameterMapAsLastPart
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithUsualOrderingOfTheParts
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withMalformedExecuteActionDTO_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutActionId_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutExecuteActionDTOPart_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testParsePartsAndGetParamsFlux_withBlobIdentifiers_replacesValueInParam

1 similar comment
@github-actions
Copy link

Failed server tests

  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testEnrichExecutionParams_withBlobReference_performsSubstitutionCorrectly
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithParameterMapAsLastPart
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAPIWithUsualOrderingOfTheParts
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withMalformedExecuteActionDTO_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutActionId_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testExecuteAction_withoutExecuteActionDTOPart_failsValidation
  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCEImplTest#testParsePartsAndGetParamsFlux_withBlobIdentifiers_replacesValueInParam

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 13960e0 and e8d8a02.

Files selected for processing (3)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (11 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java
Additional context used
Learnings (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1)
Learnt from: abhvsn
PR: appsmithorg/appsmith#33894
File: app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java:256-258
Timestamp: 2024-05-31T13:06:01.938Z
Learning: Different values for `EMAIL_DOMAIN_HASH` and `ADMIN_EMAIL_DOMAIN_HASH` are used in events to facilitate granular filtering on third-party services.
Additional comments not posted (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AnalyticsServiceCEImpl.java (1)

209-209: Ensure proper handling of sensitive data.

The removal of the request key from analyticsProperties for self-hosted instances is a good step towards enhancing privacy. Ensure that this aligns with your overall data privacy strategy and that no other sensitive data is inadvertently exposed.

Verification successful

Ensure sensitive data is handled appropriately in analytics properties.

The code effectively removes potentially sensitive information, such as the request key, from analyticsProperties for self-hosted instances. Additionally, sensitive fields like email domains are hashed, which is a good practice. Ensure that all sensitive data is either removed or properly anonymized before being sent in analytics events.

  • Verify that no other sensitive data is included without proper anonymization or removal.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that no sensitive data is included in `analyticsProperties` for self-hosted instances.

# Test: Search for any sensitive data handling in `sendEvent` method. Expect: No sensitive data should be present.
rg --type java 'analyticsProperties.put' -A 3

Length of output: 30976

@NilanshBansal NilanshBansal merged commit c899ba6 into release Aug 14, 2024
@NilanshBansal NilanshBansal deleted the feat/issue-35291/added-mixpanel-properties-executeAction branch August 14, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Product Issues related to a specific integration ok-to-test Required label for CI Query & JS Pod Issues related to the query & JS Pod Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Update the event ExecuteAction to include new properties about bindings

2 participants