Skip to content

chore: remove outgoing metrics from proxy - #4673

Merged
koladilip merged 1 commit into
developfrom
chore.remove-outgoing-request-metrics-from-proxy
Sep 29, 2025
Merged

koladilip merged 1 commit into
developfrom
chore.remove-outgoing-request-metrics-from-proxy

Conversation

@koladilip

@koladilip koladilip commented Sep 24, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Write a brief explainer on your code changes.

What is the related Linear task?

Resolves https://linear.app/rudderstack/issue/INT-4110/fix-transformer-outgoing-request-metrics

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.

@koladilip
koladilip requested review from a team and sivashanmukh as code owners September 24, 2025 05:00
@koladilip
koladilip requested review from a team, krishna2020 and manish339k September 24, 2025 05:00
@coderabbitai

coderabbitai Bot commented Sep 24, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Simplified the networking layer by removing deprecated telemetry hooks and unused metrics reporting. No changes to user-facing behavior or API.
  • Tests
    • Updated and removed related test cases to align with the streamlined networking logic.
  • Chores
    • Cleaned up unused dependencies and imports, reducing maintenance overhead and bundle surface.
    • Minor internal control-flow cleanup without affecting request/response handling.

Walkthrough

The change removes outgoing HTTP statistics collection from the network adapter by deleting stats helpers and their exports, updating imports, and pruning associated test cases. Request/response behavior and public HTTP methods remain unchanged. Tests are updated to reflect the removed export.

Changes

Cohort / File(s) Summary of Changes
Remove HTTP stats collection
src/adapters/network.js
Deleted fireOutgoingReqStats and fireHTTPStats helpers; removed related imports/exports; eliminated startTime and stats invocation; retained request/response handling and logging; imports now limited to removeUndefinedValues and isDefinedAndNotNullAndNotEmpty from ../v0/util.
Align tests with removed export
src/adapters/network.test.js
Removed import and test suite for fireHTTPStats; no other test logic altered.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant NetworkAdapter
  participant HTTPClient

  rect rgb(245,245,255)
  note over Caller,HTTPClient: Previous flow (with stats)
  Caller->>NetworkAdapter: httpGET/httpPOST/httpSend(...)
  NetworkAdapter->>HTTPClient: Send HTTP request
  HTTPClient-->>NetworkAdapter: Response/Error
  NetworkAdapter->>NetworkAdapter: Log request/response
  NetworkAdapter->>StatsService: fireHTTPStats(startTime, tags)  %% removed
  NetworkAdapter-->>Caller: Result
  end

  rect rgb(245,255,245)
  note over Caller,HTTPClient: New flow (stats removed)
  Caller->>NetworkAdapter: httpGET/httpPOST/httpSend(...)
  NetworkAdapter->>HTTPClient: Send HTTP request
  HTTPClient-->>NetworkAdapter: Response/Error
  NetworkAdapter->>NetworkAdapter: Log request/response
  NetworkAdapter-->>Caller: Result
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • sivashanmukh
  • krishna2020
  • manish339k

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR body contains the repository template and the Linear task link but the primary descriptive section "What are the changes introduced in this PR?" was left as placeholder text, and several template fields (objectives, technical notes, and the developer checklist) are not filled in, so reviewers lack a concise summary of the code changes, rationale, and testing performed. Although the Linear link is present, the description is incomplete for an effective review because it does not state the files changed, the removed functions, or whether this introduces any breaking or behavioral changes. Please replace the placeholder text with a short summary of the changes (e.g., removed outgoing metrics helpers fireOutgoingReqStats/fireHTTPStats in src/adapters/network.js and updated src/adapters/network.test.js), state the reason for the removal, note testing performed and whether this is a breaking change, and complete the developer checklist; including the Linear ID (INT-4110) in the body is also recommended for traceability.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "chore: remove outgoing metrics from proxy" is a concise, single-sentence summary that accurately reflects the primary change in the diff — removal of outgoing-request metrics and related helpers (e.g., fireOutgoingReqStats/fireHTTPStats) and the associated test updates in src/adapters/network.js. It uses the conventional "chore" prefix and provides clear intent for reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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.remove-outgoing-request-metrics-from-proxy

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@koladilip
koladilip changed the base branch from main to develop September 24, 2025 05:01
@koladilip
koladilip force-pushed the chore.remove-outgoing-request-metrics-from-proxy branch from b4e1aed to 8fa97e2 Compare September 24, 2025 05:02
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Sep 24, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.78%. Comparing base (2a5b355) to head (8fa97e2).
⚠️ Report is 33 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4673      +/-   ##
===========================================
- Coverage    91.78%   91.78%   -0.01%     
===========================================
  Files          642      642              
  Lines        33976    33979       +3     
  Branches      8034     8025       -9     
===========================================
+ Hits         31186    31188       +2     
- Misses        2560     2561       +1     
  Partials       230      230              

☔ 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.

@sonarqubecloud

sonarqubecloud Bot commented Sep 24, 2025 •

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (8)
src/adapters/network.js (8)

95-122: Log the method even for httpSend; also pass it to the mock adapter.
httpSend calls don’t set the local method; fall back to requestOptions.method to keep logs/tests consistent.

   logger.requestLog(`${commonMsg} request`, {
     metadata: statTags?.metadata,
     requestDetails: {
       url: url || requestOptions?.url,
       body: data || requestOptions?.data,
-      method,
+      method: method ?? requestOptions?.method,
     },
   });
@@
-  setResponsesForMockAxiosAdapter({ url, data, method, options }, clientResponse);
+  setResponsesForMockAxiosAdapter(
+    { url, data, method: method ?? requestOptions?.method, options },
+    clientResponse
+  );

59-73: Improve error logging when no Axios response is present (network/DNS timeouts).
Currently returns {}. Include error message/code for better observability without reintroducing metrics.

   if (!clientResponse.success) {
     const { response } = clientResponse.response;
     // non 2xx status handling for axios response
     if (response) {
       const { data, status, headers } = response;
       return {
         body: data || '',
         status: status || 500,
         ...(isDefinedAndNotNullAndNotEmpty(headers) ? { headers } : {}),
       };
     }
-    return {};
+    const errObj = clientResponse.response;
+    return removeUndefinedValues({
+      error: errObj?.message,
+      code: errObj?.code,
+    });
   }

316-324: Don’t overwrite incoming User-Agent.
Honor an existing caller-supplied UA and set RudderLabs only as a default.

-  // Ref: https://github.com/rudderlabs/rudder-server/blob/master/router/network.go#L164
-  headers['User-Agent'] = 'RudderLabs';
+  // Ref: https://github.com/rudderlabs/rudder-server/blob/master/router/network.go#L164
+  if (!headers['User-Agent'] && !headers['user-agent']) {
+    headers['User-Agent'] = 'RudderLabs';
+  }

35-37: Avoid duplicate maxBodyLength sources.
It’s set here and again via enhanceRequestOptions (from env). Keep a single source to prevent drift.

-  // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed,
-  maxBodyLength: 1000 * 1000 * 10,
+  // maxBodyLength is set in enhanceRequestOptions from env (MAX_BODY_LENGTH)

343-351: Fix doc typo: “wrapped.”
Minor doc polish.

- *  - __processedResponse__: indicates a wrapeed response object returned from processedAxiosResponse
+ *  - __processedResponse__: indicates a wrapped response object returned from processAxiosResponse

374-376: Fix doc typos: “deprecating”, “requests.”
Small cleanup.

- * depricating: handles proxying requests to destinations from server, expects requsts in "defaultRequestConfig"
+ * deprecating: handles proxying requests to destinations from server, expects requests in "defaultRequestConfig"

1-2: Limit or remove file-wide ESLint disables.
If not strictly needed, drop these or scope them locally to avoid hiding real issues.

-/* eslint-disable no-restricted-syntax */
-/* eslint-disable no-undef */
+/* eslint-disable-next-line no-undef */ /* remove if not needed */

Please run the linter to confirm no new errors surface after narrowing.


114-118: Confirm sensitive data redaction in logs.
responseDetails may include headers/body. Ensure logger.requestLog/responseLog redact tokens, PII, and cap payload sizes to avoid compliance risks.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 893da92 and 8fa97e2.

📒 Files selected for processing (2)
  • src/adapters/network.js (1 hunks)
  • src/adapters/network.test.js (0 hunks)
💤 Files with no reviewable changes (1)
  • src/adapters/network.test.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

Focus on ESLint errors (max 3) and warnings (max 5).

Files:

  • src/adapters/network.js
🧬 Code graph analysis (1)
src/adapters/network.js (3)
src/adapters/network.test.js (3)
  • require (5-18)
  • require (19-19)
  • require (37-37)
src/v0/destinations/google_adwords_offline_conversions/utils.js (5)
  • require (4-4)
  • require (5-9)
  • require (10-10)
  • require (11-22)
  • require (23-39)
src/v0/destinations/the_trade_desk/networkHandler.js (6)
  • require (1-1)
  • require (2-2)
  • require (3-6)
  • require (7-7)
  • require (8-8)
  • require (10-10)
⏰ 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). (9)
  • GitHub Check: Code Coverage
  • 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: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: UT Tests
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)

Comment thread src/adapters/network.js Resolved

@maheshkutty maheshkutty 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

@koladilip
koladilip merged commit 840bcef into develop Sep 29, 2025
@koladilip
koladilip deleted the chore.remove-outgoing-request-metrics-from-proxy branch September 29, 2025 10:56
vinayteki95 added a commit that referenced this pull request Oct 22, 2025
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.

3 participants