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: spans added in ast service for RTS calls #39823

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Mar 20, 2025

Description

Spans added in AST service for RTS calls, this is done to help us debug SLO alerts for JS object update API

Fixes #39799
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.Datasource"

🔍 Cypress test results

Tip

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


Thu, 20 Mar 2025 10:16:02 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Improved monitoring has been integrated to better track performance during dynamic operations, contributing to a more reliable system.
  • Refactor
    • Internal service processes have been streamlined to support enhanced observability, ensuring smoother diagnostics and overall stability for a better user experience.

Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

The changes add new constants for span naming in the on-load spans class and integrate them into observability code. The modifications update methods in executable and service classes to name and tap reactive streams with Micrometer observations. Additionally, constructors now inject an ObservationRegistry to improve RTS call monitoring. These changes aim to provide enhanced visibility into dynamic binding references and RTS server calls.

Changes

File Change Summary
app/server/.../OnLoadSpanCE.java Added two public constants: GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING and AST_SERVICE_CALLING_RTS_API for span naming.
app/server/.../OnLoadExecutablesUtilCEImpl.java Imported the new constant; updated the flux in getPossibleEntityReferencesMap() to use .name() and .tap() for Micrometer observation.
app/server/.../AstServiceImpl.java Updated the constructor to accept an additional ObservationRegistry parameter and modified the superclass call accordingly.
app/server/.../AstServiceCEImpl.java Injected an ObservationRegistry field and enhanced the getPossibleReferencesFromDynamicBinding() method with flux naming, observation tap, and added tags.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Caller
    participant Executor as OnLoadExecutablesUtilCEImpl
    participant Micrometer as Micrometer
    Client->>Executor: getPossibleEntityReferencesMap()
    Executor->>Micrometer: flux.name(GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING)
    Executor->>Micrometer: flux.tap(ObservationRegistry)
    Micrometer-->>Executor: Observation recorded
Loading
sequenceDiagram
    participant Caller as Client
    participant Service as AstServiceCEImpl
    participant Micrometer as Micrometer
    Caller->>Service: getPossibleReferencesFromDynamicBinding(bindings, eval_version)
    Service->>Micrometer: .name(AST_SERVICE_CALLING_RTS_API)
    Service->>Micrometer: .tap(ObservationRegistry) with tags ("no_of_bindings", "eval_version")
    Micrometer-->>Service: Metrics logged
Loading

Assessment against linked issues

Objective Addressed Explanation
Add spans for understanding why RTS calls take time sometimes (#39799)

Possibly related PRs

Suggested labels

Task, Query & JS Pod, Integrations Product, Integrations Pod General, ok-to-test, JS Evaluation, skip-changelog

Suggested reviewers

  • nidhi-nair
  • ApekshaBhosale

Poem

In our realm of code and trace,
New spans shine with a steady grace,
Constants carved with purpose clear,
Invoking metrics far and near,
Observations dance in every byte,
Embracing change with pure delight!
🎉🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c162311 and c695fd1.

📒 Files selected for processing (4)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/OnLoadSpanCE.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java (5 hunks)
🧰 Additional context used
🧬 Code Definitions (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/OnLoadSpanCE.java (1) (1)
  • OnLoadSpanCE (5-23)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java (1) (1)
  • Slf4j (41-296)
app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (1) (1)
  • Slf4j (68-1467)
app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/OnLoadSpanCE.java (1) (1)
  • OnLoadSpanCE (5-23)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (9)
app/server/appsmith-server/src/main/java/com/appsmith/server/onload/internal/OnLoadExecutablesUtilCEImpl.java (2)

61-61: Import added for dynamic binding span constant

Added import for the GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING constant from the OnLoadSpanCE class to be used for naming spans in the flux.


671-674: Added observability for dynamic binding references

Added span naming and Micrometer observation tap to the AST service call that retrieves possible references from dynamic bindings. This will improve visibility into these calls for monitoring and debugging SLO alerts.

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ce/OnLoadSpanCE.java (1)

19-22: Added new span constants for RTS calls

Added two new constants for span naming:

  1. GET_POSSIBLE_REFERENCES_FROM_DYNAMIC_BINDING - For tracking dynamic binding reference resolution
  2. AST_SERVICE_CALLING_RTS_API - For tracking AST service calls to the RTS API

These constants will allow for better monitoring and debugging of SLO alerts related to the JS object update API.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/AstServiceImpl.java (2)

7-7: Added ObservationRegistry import

Added import for ObservationRegistry from Micrometer to enable observability features.


15-20: Updated constructor to include ObservationRegistry

Modified the constructor to accept an ObservationRegistry parameter and pass it to the superclass. This enables observability features in the AST service for monitoring RTS calls.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/AstServiceCEImpl.java (4)

11-11: Added imports for observability

Added imports for ObservationRegistry and Micrometer to support metrics observation of RTS calls.

Also applies to: 21-21


39-40: Added import for AST service span constant

Added static import for the AST_SERVICE_CALLING_RTS_API constant from OnLoadSpanCE to name spans in the observation.


50-50: Added ObservationRegistry field

Added a field for the ObservationRegistry that will be used to create observations for RTS calls.


127-130: Enhanced observability for RTS API calls

Added comprehensive observability to the RTS API calls with:

  1. Named span using the AST_SERVICE_CALLING_RTS_API constant
  2. Micrometer observation tap to record metrics
  3. Added tags for the number of bindings and evaluation version to provide context for the calls

This enhancement will help with debugging SLO alerts and monitoring performance of RTS calls.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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 Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Query & Widgets Pod All issues related to Query, JS, Eval, and Widgets Task A simple Todo Unplanned Work - Q&W Work items that are unplanned skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Mar 20, 2025
@sneha122 sneha122 requested a review from NilanshBansal March 20, 2025 09:32
@sneha122 sneha122 added the ok-to-test Required label for CI label Mar 20, 2025
@sneha122 sneha122 merged commit 81c263a into release Mar 20, 2025
47 checks passed
@sneha122 sneha122 deleted the chore/add-spans-ast-parsing-js-update-api branch March 20, 2025 12:02
@coderabbitai coderabbitai bot mentioned this pull request Mar 21, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration ok-to-test Required label for CI Query & Widgets Pod All issues related to Query, JS, Eval, and Widgets skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo Unplanned Work - Q&W Work items that are unplanned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Add spans for understanding why RTS calls takes time sometimes
2 participants