Repository navigation
chore: remove outgoing metrics from proxy - #4673
Conversation
Summary by CodeRabbit
WalkthroughThe 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
b4e1aed to
8fa97e2
Compare
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
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
📒 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)
This reverts commit 840bcef.

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.