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: capture performance of parsing api response #37081

Merged
merged 4 commits into from
Oct 25, 2024
Merged

chore: capture performance of parsing api response #37081

merged 4 commits into from
Oct 25, 2024

Conversation

vsvamsi1
Copy link
Contributor

@vsvamsi1 vsvamsi1 commented Oct 25, 2024

Description

Capture performance of parsing api responses.

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

Tip

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


Fri, 25 Oct 2024 06:47:52 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a telemetry feature for enhanced monitoring of API requests and responses.
  • Bug Fixes

    • Improved error handling by logging issues when default transformation functions are not found.

@vsvamsi1 vsvamsi1 added the ok-to-test Required label for CI label Oct 25, 2024
@vsvamsi1 vsvamsi1 self-assigned this Oct 25, 2024
Copy link
Contributor

coderabbitai bot commented Oct 25, 2024

Walkthrough

The changes introduce a telemetry feature to the Axios instance in the Api.ts file. A new import statement is added for startAndEndSpanForFn, and the axiosInstance.defaults.transformResponse property is modified to wrap the default response transformation in telemetry code. This ensures that telemetry spans are created around the transformation process, while existing request and response interceptors remain unchanged.

Changes

File Path Change Summary
app/client/src/api/Api.ts Added telemetry feature by modifying transformResponse to include telemetry span around transformations. Imported startAndEndSpanForFn from UITelemetry/generateTraces.

Possibly related PRs

  • chore: ce changes decoupled mixpannel chunk #36979: The changes in this PR involve modifications to user analytics tracking, which may relate to the telemetry feature introduced in the main PR, as both involve tracking user interactions and data handling.

Suggested labels

Performance, Task

Suggested reviewers

  • sharat87
  • rajatagrawal
  • ApekshaBhosale

🎉 In code we trust, with spans we align,
Telemetry whispers, "Performance is fine!"
Axios now dances, with metrics in sight,
Transformations wrapped, oh what a delight!
So let’s raise our glasses, to changes so bright! 🍻


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 46887ac and 92f9d88.

📒 Files selected for processing (1)
  • app/client/src/api/Api.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/api/Api.ts

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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Oct 25, 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: 1

🧹 Outside diff range and nitpick comments (3)
app/client/src/api/Api.ts (3)

29-29: Fix typo in variable name

The variable name has a typo: transfromFn should be transformFn

-      const transfromFn = transformResponseAr?.[0];
+      const transformFn = transformResponseAr?.[0];

38-42: Enhance error logging

The error logging could be more informative by including the response data type and size.

-      console.error("could not find the api transformerFn");
+      console.error("API transform function not found", {
+        dataType: typeof args[0],
+        dataSize: args[0]?.length,
+      });

23-45: Consider performance implications of transform wrapping

While adding telemetry is valuable, wrapping every response transformation might impact performance for high-frequency API calls. Consider:

  1. Sampling the telemetry data
  2. Adding a threshold for logging only slow transformations
  3. Adding the ability to disable this in production if needed
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3d9d08a and c80224e.

📒 Files selected for processing (1)
  • app/client/src/api/Api.ts (2 hunks)
🔇 Additional comments (2)
app/client/src/api/Api.ts (2)

10-10: LGTM: Clean import addition

The telemetry function import is well-placed and appropriately named.


32-32: Verify URL context availability

The this.url might be undefined in some contexts. Consider adding a fallback.

@vsvamsi1
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

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

Copy link

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

@vsvamsi1
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

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

Copy link

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

@vsvamsi1 vsvamsi1 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Oct 25, 2024
@vsvamsi1 vsvamsi1 requested a review from dvj1988 October 25, 2024 05:15
@vsvamsi1 vsvamsi1 merged commit 56ef430 into release Oct 25, 2024
91 of 97 checks passed
@vsvamsi1 vsvamsi1 deleted the release6 branch October 25, 2024 06:48
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
## Description
Capture performance of parsing api responses.

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
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11512264036>
> Commit: 92f9d88
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11512264036&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 25 Oct 2024 06:47:52 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 a telemetry feature for enhanced monitoring of API requests
and responses.

- **Bug Fixes**
- Improved error handling by logging issues when default transformation
functions are not found.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants