chore: added instrumentation for js object update#36999
chore: added instrumentation for js object update#36999NilanshBansal merged 2 commits intoreleasefrom
Conversation
WalkthroughThe changes in this pull request involve the addition of multiple new constants across various classes in the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (3)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ApplicationSpanCE.java (1)
10-10: LGTM. Consider adding a brief comment.The new constant
APPLICATION_SAVE_LAST_EDIT_INFO_SPANis well-named and consistent with the existing pattern. It's correctly using theAPPLICATION_ID_SPANas a base.Consider adding a brief comment above the constant to describe its purpose, similar to:
// Span for tracking the saving of last edit information public static final String APPLICATION_SAVE_LAST_EDIT_INFO_SPAN = APPLICATION_ID_SPAN + ".save_last_edit_info";app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java (1)
18-18: Approved with a minor suggestion.The new constant
GET_PAGE_BY_ID_AND_LAYOUTS_IDis well-defined and aligns with the PR objectives. For consistency with other constants, consider using uppercase for the entire string value.- public static final String GET_PAGE_BY_ID_AND_LAYOUTS_ID = APPSMITH_SPAN_PREFIX + "getPageByIdAndLayoutsId"; + public static final String GET_PAGE_BY_ID_AND_LAYOUTS_ID = APPSMITH_SPAN_PREFIX + "GET_PAGE_BY_ID_AND_LAYOUTS_ID";app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java (1)
40-41: LGTM. Consider grouping related constants.The new constant follows the established naming convention and uses the correct prefix. It's well-aligned with the PR objectives.
Consider grouping this constant with other action-related spans for better organization.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (8)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ActionSpanCE.java (1 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/ApplicationSpanCE.java (1 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java (1 hunks)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/PageSpanCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/onload/ExecutableOnPageLoadServiceCEImpl.java (5 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/onload/ExecutableOnPageLoadServiceImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (10 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilImpl.java (2 hunks)
🧰 Additional context used
🔇 Additional comments (15)
app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilImpl.java (1)
4-4: LGTM. Instrumentation added as per requirements.The changes align with the PR objectives. New dependencies and constructor modifications enhance observability.
Let's ensure consistency across the codebase:
Also applies to: 8-8, 19-22
app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/onload/ExecutableOnPageLoadServiceImpl.java (4)
10-10: LGTM: Import statement for ObservationRegistry.The import is correctly added and aligns with the new parameter in the constructor.
23-24: LGTM: Constructor signature updated with ObservationRegistry.The new parameter is correctly added and aligns with the PR objective of adding instrumentation.
25-31: LGTM: Superclass constructor call updated.The superclass constructor call correctly includes the new
observationRegistryparameter, ensuring proper initialization.
Line range hint
1-33: Verify consistency across related classes.The changes in this file look good and align with the PR objective. To ensure overall consistency, it would be beneficial to verify if similar changes have been made in related classes that might also require observability features.
✅ Verification successful
Consistency Verified Across Related Classes
The addition of
ObservationRegistryinExecutableOnPageLoadServiceImpl.javaaligns with the implemented changes in related classes, ensuring consistency in observability features across the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for similar changes in related classes # Test: Search for classes with similar naming patterns echo "Related classes:" fd -e java '(ExecutableOnPageLoad|OnLoadExecutables).*Impl\.java$' # Test: Check for ObservationRegistry usage in these classes echo "\nObservationRegistry usage in related classes:" fd -e java '(ExecutableOnPageLoad|OnLoadExecutables).*Impl\.java$' -x rg -n 'ObservationRegistry'Length of output: 1227
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java (5)
21-22: LGTMThe constant is well-named and follows the class conventions.
23-23: LGTMThe constant is appropriately named and follows the class conventions.
24-25: LGTMThe constant is well-defined and follows the class naming conventions.
26-27: LGTMThe constant is appropriately named and adheres to the class conventions.
19-27: Overall, the changes look good with one minor issueThe new constants added for instrumentation align well with the PR objectives. They follow the existing naming conventions and provide clear, descriptive names for the spans. Just make sure to fix the typo in the first constant as mentioned earlier.
app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/onload/ExecutableOnPageLoadServiceCEImpl.java (5)
17-31: Imports added for observability enhancementsThe new imports and constants are correctly added to support the observability features in the code.
43-43: ObservationRegistry field declaration is appropriateThe
ObservationRegistryis properly declared as a final field, ensuring it's correctly injected and used for tracing.
58-59: Instrumentation added tofillSelfReferencingPathsmethodThe observability enhancements using
.name(FILL_SELF_REFERENCING_PATHS_ACTION)and.tap(Micrometer.observation(observationRegistry))are correctly applied to the reactive chain.
81-82: Observability incorporated infindByIdAndLayoutsIdcallThe addition of
.name(GET_PAGE_BY_ID_AND_LAYOUTS_ID)and.tap(Micrometer.observation(observationRegistry))appropriately enhances the tracing of this method.
107-108: Enhanced tracing insaveLastEditInformationoperationIncluding
.name(APPLICATION_SAVE_LAST_EDIT_INFO_SPAN)and.tap(Micrometer.observation(observationRegistry))effectively adds observability to this operation.
...appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java
Outdated
Show resolved
Hide resolved
...th-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java
Outdated
Show resolved
Hide resolved
...th-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java
Show resolved
Hide resolved
...appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java (1 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (10 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/LayoutSpanCE.java
🧰 Additional context used
| .name(RECURSIVELY_ADD_EXECUTABLES_AND_THEIR_DEPENDENTS_TO_GRAPH_FROM_BINDINGS) | ||
| .tap(Micrometer.observation(observationRegistry)) |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Refactor repetitive Micrometer instrumentation code
The code pattern with .name(...) and .tap(Micrometer.observation(observationRegistry)) is used multiple times. Consider creating a utility method to encapsulate this pattern and reduce duplication.
Example:
private <T> Mono<T> instrument(Mono<T> mono, String name) {
return mono
.name(name)
.tap(Micrometer.observation(observationRegistry));
}Then, replace:
someMonoOperation()
.name(SOME_CONSTANT)
.tap(Micrometer.observation(observationRegistry));with:
instrument(someMonoOperation(), SOME_CONSTANT);Also applies to: 649-650, 930-931, 948-949, 1002-1003
| // TODO : Add all the global variables exposed on the client side. | ||
| private final Set<String> APPSMITH_GLOBAL_VARIABLES = Set.of(); | ||
| private final ObservationRegistry observationRegistry; | ||
| private final ObservationHelperImpl observationHelper; |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Use interface type for observationHelper
Consider declaring observationHelper as ObservationHelper instead of ObservationHelperImpl to depend on the interface rather than the implementation.
Apply this diff:
-private final ObservationHelperImpl observationHelper;
+private final ObservationHelper observationHelper;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private final ObservationHelperImpl observationHelper; | |
| private final ObservationHelper observationHelper; |
## Description > This PR adds the granular level instrumentation for the JS Object update calls. Fixes appsmithorg#36996 ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 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/11444602012> > Commit: 2e31a47 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11444602012&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Mon, 21 Oct 2024 17:07:30 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new constants for action spans, application spans, layout spans, and page spans to enhance tracking capabilities. - Enhanced observability features in services related to page load and executable management. - **Bug Fixes** - Improved error handling for page and layout ID retrieval. - **Refactor** - Updated constructors and method signatures to incorporate new observability dependencies. These changes aim to improve tracking, error handling, and overall performance of the application. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Fixes #36996
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/11444602012
Commit: 2e31a47
Cypress dashboard.
Tags:
@tag.SanitySpec:
Mon, 21 Oct 2024 17:07:30 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
These changes aim to improve tracking, error handling, and overall performance of the application.