chore: Add newrelic tracking spans to AppViewer engine and AppEditor engine#34716
chore: Add newrelic tracking spans to AppViewer engine and AppEditor engine#34716
Conversation
WalkthroughThis update introduces telemetry spans for performance tracking within the Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant startAppEngine
participant Engine
participant Telemetry
UI ->> startAppEngine: Dispatch action
startAppEngine ->> Telemetry: startRootSpan("startAppEngine")
Telemetry -->> startAppEngine: rootSpan
startAppEngine ->> Engine: setupEngine(payload, rootSpan)
Engine ->> Telemetry: startNestedSpan("setupEngine", rootSpan)
Engine ->> Engine: Perform setup tasks
Engine ->> Telemetry: endSpan(setupEngineSpan)
Engine ->> startAppEngine: Setup complete
startAppEngine ->> Engine: loadAppData(payload, rootSpan)
Engine ->> Telemetry: startNestedSpan("loadAppData", rootSpan)
Engine ->> Engine: Load application data
Engine ->> Telemetry: endSpan(loadAppDataSpan)
Engine -->> startAppEngine: Data loading complete
startAppEngine ->> Telemetry: endSpan(rootSpan)
startAppEngine -->> UI: Application ready
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
/build-deploy-preview skip-tests=true |
|
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9792055839. |
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- app/client/src/UITelemetry/generateTraces.ts (1 hunks)
- app/client/src/entities/Engine/AppEditorEngine.ts (8 hunks)
- app/client/src/entities/Engine/AppViewerEngine.ts (4 hunks)
- app/client/src/entities/Engine/index.ts (5 hunks)
- app/client/src/sagas/ActionExecution/PluginActionSaga.ts (3 hunks)
- app/client/src/sagas/InitSagas.ts (2 hunks)
Additional context used
Biome
app/client/src/entities/Engine/index.ts
[error] 132-132: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
Additional comments not posted (24)
app/client/src/UITelemetry/generateTraces.ts (2)
79-80: LGTM!The
endSpanfunction correctly handles the optionalspanparameter using optional chaining.
84-87: LGTM!The
setAttributesToSpanfunction correctly handles the optionalspanparameter using optional chaining.app/client/src/entities/Engine/index.ts (2)
34-41: LGTM!The changes to the
IAppEngineinterface align with the PR objective to add New Relic tracking spans to all function calls within the AppViewer and AppEditor engines.
64-66: LGTM!The changes to the
AppEngineabstract class align with the PR objective to add New Relic tracking spans to all function calls within the AppViewer and AppEditor engines.Also applies to: 69-75
app/client/src/entities/Engine/AppViewerEngine.ts (6)
54-66: LGTM!The changes to the
completeChoremethod align with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.
69-77: LGTM!The changes to the
setupEnginemethod align with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.
Line range hint
96-175:
LGTM!The changes to the
loadAppEntitiesmethod align with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.
152-158: LGTM!The addition of the
waitForFetchUserSuccessspan aligns with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.
159-165: LGTM!The addition of the
waitForSegmentInitspan aligns with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.
166-172: LGTM!The addition of the
waitForFetchEnvironmentsspan aligns with the PR objective to add New Relic tracking spans to all function calls within the AppViewer engine.app/client/src/entities/Engine/AppEditorEngine.ts (6)
92-102: LGTM!The changes to the
setupEnginemethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.
Line range hint
121-197:
LGTM!The changes to the
loadPageThemesAndActionsmethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.
Line range hint
200-241:
LGTM!The changes to the
loadPluginsAndDatasourcesmethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.
252-261: LGTM!The changes to the
loadAppEntitiesmethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.
Line range hint
264-327:
LGTM!The changes to the
completeChoremethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.
Line range hint
330-349:
LGTM!The changes to the
loadGitmethod align with the PR objective to add New Relic tracking spans to all function calls within the AppEditor engine.app/client/src/sagas/InitSagas.ts (3)
88-92: LGTM!The new imports for New Relic tracking spans are appropriate.
292-297: LGTM!The addition of the root span and nested spans in the
startAppEnginefunction is correct and enhances monitoring and performance tracking.Also applies to: 305-306, 307-310, 315-317, 324-325, 331-331, 339-339, 341-342, 350-351
Line range hint
1290-1291:
LGTM!The use of
startRootSpanandsetAttributesToSpanin theexecutePageLoadActionsSagafunction is appropriate and improves performance tracking.app/client/src/sagas/ActionExecution/PluginActionSaga.ts (5)
Line range hint
105-107:
LGTM!The new imports for New Relic tracking spans are appropriate.
543-547: LGTM!The addition of the root span and setting attributes in the
executePluginActionTriggerSagafunction enhances monitoring and performance tracking.
Line range hint
1061-1061:
LGTM!The addition of the root span in the
runActionSagafunction is correct and enhances monitoring and performance tracking.
1290-1290: LGTM!The addition of the root span and setting attributes in the
executePageLoadActionsSagafunction enhances monitoring and performance tracking.
1347-1352: LGTM!The addition of setting attributes to the parent span in the
executePluginActionSagafunction enhances monitoring and performance tracking.
| } | ||
|
|
||
| *loadAppURL(pageId: string, pageIdInUrl?: string) { | ||
| *loadAppURL(pageId: string, pageIdInUrl: string = "", rootSpan: Span) { |
There was a problem hiding this comment.
Address the default parameter issue.
The default parameter should follow the last required parameter.
- *loadAppURL(pageId: string, pageIdInUrl: string = "", rootSpan: Span) {
+ *loadAppURL(pageId: string, rootSpan: Span, pageIdInUrl: string = "") {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.
| *loadAppURL(pageId: string, pageIdInUrl: string = "", rootSpan: Span) { | |
| *loadAppURL(pageId: string, rootSpan: Span, pageIdInUrl: string = "") { |
Tools
Biome
[error] 132-132: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
|
Deploy-Preview-URL: https://ce-34716.dp.appsmith.com |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- app/client/src/entities/Engine/index.ts (5 hunks)
- app/client/src/sagas/InitSagas.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- app/client/src/entities/Engine/index.ts
- app/client/src/sagas/InitSagas.ts
| const loadAppUrlSpan = startNestedSpan("AppEngine.loadAppURL", rootSpan); | ||
|
|
||
| if (!this._urlRedirect) return; | ||
| const newURL: string = yield call( | ||
| this._urlRedirect.generateRedirectURL.bind(this), | ||
| pageId, | ||
| pageIdInUrl, | ||
| ); | ||
|
|
||
| endSpan(loadAppUrlSpan); | ||
|
|
There was a problem hiding this comment.
Is this necessary, no blocking or expensive code here?
There was a problem hiding this comment.
yeah that's true, I just added them to all components.
There was a problem hiding this comment.
Also i think the start span should be after the return statement in line 144, so that we don't have an incomplete span.
There was a problem hiding this comment.
loadAppData set the value of _urlRedirect and it is called before loadAppURL in initSagas. This block is present for just type safety.
But yeah I agree, we should avoid any case where there are spans that don't end.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/src/entities/Engine/index.ts (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- app/client/src/entities/Engine/index.ts
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- app/client/src/sagas/tests/initSagas.test.ts (2 hunks)
Additional comments not posted (6)
app/client/src/sagas/__tests__/initSagas.test.ts (6)
13-13: Import statement looks good.The import statement for
startRootSpanis necessary for the changes.
54-55: CreatingmockRootSpanlooks good.Creating
mockRootSpanusingstartRootSpanis necessary for the test cases.
60-60: Updated method call looks good.The
setupEnginemethod is correctly called withaction.payloadandmockRootSpan.
66-66: Updated method call looks good.The
loadAppDatamethod is correctly called withaction.payload,mockResponse.data, andmockRootSpan.
71-75: Updated method call looks good.The
loadAppURLmethod is correctly called with an object containingpageId,pageIdInUrl, androotSpan.
82-82: Updated method calls look good.The methods
loadAppEntities,loadGit, andcompleteChoreare correctly called withmockRootSpan.Also applies to: 85-85, 87-87
Description
Add new relic tracking spans to all fn calls in Appviewer and AppEditor engine.
Fixes #
Issue Numberor
Fixes
Issue URLWarning
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.Sanity"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9868467158
Commit: 9267930
Cypress dashboard.
Tags:
@tag.SanitySpec:
Wed, 10 Jul 2024 05:32:52 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Tests