Skip to content

chore: update fetch stats - #4539

Merged
cisse21 merged 3 commits into
developfrom
chore.updateStats
Jul 30, 2025
Merged

cisse21 merged 3 commits into
developfrom
chore.updateStats

Conversation

@cisse21

@cisse21 cisse21 commented Jul 29, 2025 •

Copy link
Copy Markdown
Member

What are the changes introduced in this PR?

Currently there are no stats fetch stats emitted when we encounter an error in the ivm library. This PR attempts to send a stat for the fetch call irrespective of a success or a failure

What is the related Linear task?

Resolves PIPE-2268

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

@coderabbitai

coderabbitai Bot commented Jul 29, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor

    • Improved timing and success/failure tagging for asynchronous operations, ensuring metrics are always recorded with success status.
    • Updated metric labels to include success status for enhanced monitoring.
    • Removed debug-level logging of request bodies in user transformation controllers.
  • Chores

    • Added new code ownership for specific directories.
    • Updated linting and code analysis configurations to exclude additional files.

Walkthrough

This update enhances fetch timing instrumentation and success/failure tagging in the asynchronous fetch functions within src/util/customTransformer.js and src/util/ivmFactory.js. It also removes debug-level request body logging from UserTransformController methods and updates SonarQube configuration to exclude specific files from copy-paste detection.

Changes

Cohort / File(s) Change Summary
SonarQube Exclusion Update
sonar-project.properties
Expands copy-paste detection exclusions to include src/util/ivmFactory.js and src/util/customTransformer.js alongside the test directory.
Controller Logging Cleanup
src/controllers/userTransform.ts
Removes debug-level logging of request bodies at the start of controller methods. No changes to method logic or signatures.
Fetch Timing Instrumentation
src/util/customTransformer.js, src/util/ivmFactory.js
Adds robust timing and success/failure tagging to _fetch, _fetchV2, and _geolocation functions. Timing metrics are now always recorded in a finally block with success status, and error logging is improved. No changes to exported APIs.
CODEOWNERS Update
CODEOWNERS
Adds @rudderlabs/server_team as a code owner for the src/util/ directory alongside existing owners.
ESLint Ignore Update
.eslintignore
Adds CODEOWNERS file to ESLint ignore patterns to skip linting it.
Prometheus Metrics Label Update
src/util/prometheus.js
Adds isSuccess as an additional label name to the fetch_call_duration, fetchV2_call_duration, and geo_call_duration histogram metrics.

Sequence Diagram(s)

sequenceDiagram
    participant VMContext as Isolated VM Context
    participant Fetch as Fetch Function
    participant Stats as Timing Logger

    VMContext->>Fetch: Call _fetch/_fetchV2/_geolocation with trTags
    Fetch->>Fetch: Record startTime
    Fetch->>Fetch: Copy trTags to localTags
    alt Success
        Fetch->>Fetch: localTags.isSuccess = true (string or boolean)
    else Failure
        Fetch->>Fetch: localTags.isSuccess = false (string or boolean)
    end
    Fetch->>Stats: stats.timing('fetch', duration, localTags)
    Fetch-->>VMContext: Return result or throw error
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • chore: remove unused rs secrets #4462: Also modifies the _fetch and _fetchV2 functions in the same files, focusing on removing unused secret-related code and adding debug error logging. Both PRs enhance these fetch functions, but with different objectives.

Suggested reviewers

  • vinayteki95
  • sivashanmukh

Suggestions for improvement:
Consider adding automated tests or integration checks for the new timing and tagging logic to ensure consistent metric reporting. Additionally, documenting the rationale behind excluding specific files from SonarQube copy-paste detection would help future maintainers understand this configuration choice.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 54873c2a02ff13d808b7a0c69022066cd795a8d6 and 887c6bf.

📒 Files selected for processing (7)
  • .eslintignore (1 hunks)
  • CODEOWNERS (1 hunks)
  • sonar-project.properties (1 hunks)
  • src/controllers/userTransform.ts (0 hunks)
  • src/util/customTransformer.js (3 hunks)
  • src/util/ivmFactory.js (3 hunks)
  • src/util/prometheus.js (2 hunks)
💤 Files with no reviewable changes (1)
  • src/controllers/userTransform.ts
✅ Files skipped from review due to trivial changes (1)
  • sonar-project.properties
🚧 Files skipped from review as they are similar to previous changes (5)
  • CODEOWNERS
  • src/util/customTransformer.js
  • src/util/ivmFactory.js
  • src/util/prometheus.js
  • .eslintignore
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Code Coverage
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: test_and_publish
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore.updateStats

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

@codecov

codecov Bot commented Jul 29, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.63%. Comparing base (56f4d36) to head (887c6bf).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
src/util/customTransformer.js 86.66% 2 Missing ⚠️
src/util/ivmFactory.js 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4539      +/-   ##
===========================================
+ Coverage    91.57%   91.63%   +0.05%     
===========================================
  Files          639      643       +4     
  Lines        33786    34020     +234     
  Branches      7988     8048      +60     
===========================================
+ Hits         30940    31174     +234     
  Misses        2588     2588              
  Partials       258      258              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cisse21
cisse21 force-pushed the chore.updateStats branch 2 times, most recently from 9c248f9 to 6aba009 Compare July 29, 2025 10:19
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

ktgowtham
ktgowtham previously approved these changes Jul 29, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 5993297 to 57a0f74 Compare July 29, 2025 11:28
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 57a0f74 to 7d6167c Compare July 29, 2025 12:56
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 7d6167c to 8db8f45 Compare July 29, 2025 13:13
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 8db8f45 to 1167752 Compare July 29, 2025 13:22
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 1167752 to fa3f1e4 Compare July 29, 2025 13:34
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch 2 times, most recently from b4d2c26 to f6e8c1f Compare July 29, 2025 13:58
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from f6e8c1f to 963db65 Compare July 30, 2025 05:53
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 marked this pull request as ready for review July 30, 2025 06:01
@cisse21
cisse21 requested review from a team and sivashanmukh as code owners July 30, 2025 06:01
@cisse21
cisse21 requested a review from a team July 30, 2025 06:01
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@cisse21
cisse21 force-pushed the chore.updateStats branch from 2ac747a to e7110be Compare July 30, 2025 07:02
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

Jayachand
Jayachand previously approved these changes Jul 30, 2025
utsabc
utsabc previously approved these changes Jul 30, 2025
Comment thread src/util/customTransformer.js Resolved
Comment thread src/util/customTransformer.js Resolved
@cisse21
cisse21 dismissed stale reviews from utsabc and Jayachand via f741119 July 30, 2025 08:58
@cisse21
cisse21 force-pushed the chore.updateStats branch from e7110be to f741119 Compare July 30, 2025 08:58
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

ktgowtham
ktgowtham previously approved these changes Jul 30, 2025
Jayachand
Jayachand previously approved these changes Jul 30, 2025
@cisse21
cisse21 requested a review from atzoum July 30, 2025 12:39
Comment thread src/util/ivmFactory.js Resolved
Comment thread src/util/ivmFactory.js Resolved
Comment thread src/util/customTransformer.js Resolved
Comment thread src/util/customTransformer.js Resolved
Comment thread src/util/customTransformer.js Resolved
@cisse21
cisse21 dismissed stale reviews from Jayachand and ktgowtham via cca3773 July 30, 2025 13:39
@cisse21
cisse21 force-pushed the chore.updateStats branch from 54873c2 to cca3773 Compare July 30, 2025 13:39
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

@sivashanmukh sivashanmukh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@cisse21
cisse21 merged commit e136c9d into develop Jul 30, 2025
@cisse21
cisse21 deleted the chore.updateStats branch July 30, 2025 14:05
@coderabbitai coderabbitai Bot mentioned this pull request Aug 18, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants