Repository navigation
chore: payload size middleware performance improvement - #4318
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis update refactors middleware registration in a Koa application, transitioning from returning middleware functions to directly registering them on the app instance. The request and response size tracking logic is updated to use raw body data and response length. Corresponding tests are restructured to use real HTTP requests via Supertest for more accurate validation. Changes
Suggestions for Improvements
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📥 CommitsReviewing files that changed from the base of the PR and between cb529d17a624069486d61690d464dc4c26e9717b and 813c2c1. 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
🧬 Code Graph Analysis (1)src/middleware.test.js (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
🔇 Additional comments (7)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
|
Allure Test reports for this run are available at:
|
koladilip
left a comment
There was a problem hiding this comment.
thanks for making this change
cb529d1 to
813c2c1
Compare
|
Allure Test reports for this run are available at:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4318 +/- ##
===========================================
+ Coverage 91.10% 91.11% +0.01%
===========================================
Files 636 636
Lines 33378 33378
Branches 7888 7894 +6
===========================================
+ Hits 30410 30414 +4
+ Misses 2729 2725 -4
Partials 239 239 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
* feat: update destination type with optional account types (#4291) * feat: update destination type with optional account types * chore: add authenticationType * chore: update types with generics * chore: add optional config to accountDefiition * chore: update deleteAccount to regulationAccount * chore: update regulationAccount to deleteAccount * chore(destination): migrate slack destination tests to new format (#4279) * chore(destination): migrate slack destination tests to new format * refactor: tests to use proper types * chore: fix status in mailchimp, fix cognitive complexity, add unit tests (#4314) * chore: fix status in mailchimp, fix cognitive complexity, add unit tests * chore: fix PR comments for mailchimp tests * test: add tests for error cases to improve code coverage --------- Co-authored-by: Dilip Kola <[email protected]> * chore(braze): added docs for braze destination (#4297) * chore(braze): added docs for braze destination * chore: update braze docs * chore: add multiplexing section --------- Co-authored-by: Utsab Chowdhury <[email protected]> * chore: add string check for phone in gaoc (#4311) * chore: add string check for phone in gaoc * chore: add unit test * chore: update condition Co-authored-by: Sudip Paul <[email protected]> --------- Co-authored-by: Sudip Paul <[email protected]> * chore: correct dotenv import (#4320) * chore: payload size middleware performance improvement (#4318) * fix: add uuid as fallback to missing anonymousId in webhook events (#4276) * chore: bump codecov/codecov-action from 5.4.2 to 5.4.3 (#4335) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.2 to 5.4.3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v5.4.2...v5.4.3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 5.4.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: bump slackapi/slack-github-action from 1.27.0 to 2.1.0 (#4312) Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.27.0 to 2.1.0. - [Release notes](https://github.com/slackapi/slack-github-action/releases) - [Commits](slackapi/slack-github-action@v1.27.0...v2.1.0) --- updated-dependencies: - dependency-name: slackapi/slack-github-action dependency-version: 2.1.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: mp add content type header to all apis (#4344) * fix: mp add content-type header and follow strict for engage and group apis * chore: mp add content type header to all apis * feat: bluecore email subscription event (#4304) * fix: blucore optin event mapping * fix: review comments * chore: add subscription event * chore: add subscription event * fix: reviews comments * fix: review comments * fix: review comments * fix: review comments * chore: test description * chore(release): 1.101.0 * chore: pass copy of metadata to avoid actual metadata modifications (#4351) * Revert "feat: update destination type with optional account types (#4291)" (#4348) This reverts commit f368f00. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Sudip Paul <[email protected]> Co-authored-by: Yashasvi Bajpai <[email protected]> Co-authored-by: Dilip Kola <[email protected]> Co-authored-by: Dilip Kola <[email protected]> Co-authored-by: Vinay Teki <[email protected]> Co-authored-by: Utsab Chowdhury <[email protected]> Co-authored-by: Aris Tzoumas <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mahesh Kutty <[email protected]> Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: Jayachand Mopidevi <[email protected]>



Description
Instead of performing
JSON.stringifywe are using precalculated raw payload sizes for capturing metrics:transformer_http_request_size: usingctx.request.rawBodyprovided by koa-bodyparsertransformer_http_response_size: usingctx.response.lengthprovided by koaThis has a positive impact on server's performance and cpu utilization, especially while dealing with larger payloads