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

feat: cm360 router batching #2836

Merged
merged 30 commits into from
Nov 30, 2023
Merged

feat: cm360 router batching #2836

merged 30 commits into from
Nov 30, 2023

Conversation

aashishmalik
Copy link
Contributor

@aashishmalik aashishmalik commented Nov 19, 2023

Description of the change

cm360 transformer proxy v1

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Fix #1

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

Summary by CodeRabbit

  • New Features

    • Enhanced error handling in the destination post-transformation service.
    • Introduced a new error type for improved error reporting.
    • Added batch processing capabilities for campaign manager events.
  • Bug Fixes

    • Updated event type determination logic to correctly handle custom event types.
  • Refactor

    • Improved retry logic in network handlers for campaign manager.
    • Streamlined batch event processing with new utility functions.
  • Documentation

    • No visible changes to end-user documentation.
  • Style

    • Minor style adjustments in test files for better readability.
  • Tests

    • Adjusted tests to reflect changes in batch processing behavior.
  • Chores

    • Added necessary configurations for batch processing limits.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2023

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The changes across various files in the codebase primarily focus on enhancing error handling and reporting, introducing new constants and error types, and refining event processing logic. A new ErrorResponse type is added to improve error parameterization, and functions are updated to handle batch processing and error conditions more effectively. The adjustments are aimed at improving the robustness and functionality of the destination transformation services.

Changes

File Path Change Summary
src/services/destination/postTransformation.ts Added ErrorResponse type; updated handleDeliveryFailureEvents method.
src/types/index.ts Added optional response property to DeliveryResponse interface.
src/v0/destinations/am/transform.js Modified event type determination logic.
src/v0/destinations/campaign_manager/... Introduced MAX_BATCH_CONVERSATIONS_SIZE constant; updated functions for batch processing and error handling.
src/v0/util/errorTypes/... Exported new TransformerProxyError class; updated error handling.
test/... Minor whitespace addition; updated batched property from false to true.

Assessment against linked issues

Objective Addressed Explanation
#1: Merging latest GATransformer artifacts into master branch The provided summary does not mention any changes related to GATransformer artifacts or the merging of such artifacts into the master branch.

Poem

In the code where bugs may hide,
A rabbit hops with eyes so wide.
With each leap, a fix in place,
🐇💻 Errors gone without a trace.


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9eda50e and 7559d7b.
Files selected for processing (10)
  • src/services/destination/postTransformation.ts (3 hunks)
  • src/types/index.ts (1 hunks)
  • src/v0/destinations/am/transform.js (1 hunks)
  • src/v0/destinations/campaign_manager/config.js (2 hunks)
  • src/v0/destinations/campaign_manager/networkHandler.js (2 hunks)
  • src/v0/destinations/campaign_manager/transform.js (3 hunks)
  • src/v0/util/errorTypes/index.js (1 hunks)
  • src/v0/util/errorTypes/transformerProxyError.js (1 hunks)
  • test/tests/facebook_conversions.test.js (1 hunks)
  • test/integrations/destinations/campaign_manager/router/data.ts (2 hunks)
Files skipped from review due to trivial changes (3)
  • src/types/index.ts
  • src/v0/destinations/campaign_manager/config.js
  • test/tests/facebook_conversions.test.js
Additional comments: 9
src/services/destination/postTransformation.ts (2)
  • 19-25: The new ErrorResponse type is well-defined and should provide a structured way to handle errors within the DestinationPostTransformationService. Ensure that the rest of the codebase is updated to use this new type where applicable.

  • 161-172: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [150-171]

The handleDeliveryFailureEvents method has been correctly updated to accept an ErrorResponse and to conditionally include a response field if present in the error. This should enhance error handling and reporting.

src/v0/destinations/am/transform.js (1)
  • 643-649: The changes to prioritize a custom screen event name (customScreenEv) over the default event type (eventType) are correctly implemented. The use of replaceAll to substitute placeholders with actual values from the message is also correctly done.
src/v0/destinations/campaign_manager/networkHandler.js (2)
  • 93-145: The updates to the responseHandler function to handle individual events and throw a TransformerProxyError in case of failure status are correctly implemented. The function now provides more granular error handling and response population.

  • 186-186: The networkHandler function is correctly updated to include the new responseHandler function, ensuring that the network handling capabilities are extended as intended.

src/v0/util/errorTypes/index.js (1)
  • 1-7: The changes to the module's exports look correct and are properly formatted. Ensure that corresponding documentation and type definitions are updated to reflect the new public interface.
src/v0/util/errorTypes/transformerProxyError.js (1)
  • 6-28: The implementation of the TransformerProxyError class is correct and follows best practices for extending errors in JavaScript. It properly initializes default tags and allows for the specification of error type and meta tags, with validation against predefined types. The response parameter is also correctly assigned to the instance.
test/integrations/destinations/campaign_manager/router/data.ts (2)
  • 348-354: The change from batched: false to batched: true is consistent with the new batch processing behavior described in the summary. Ensure that the corresponding test cases and application logic are updated to handle this change correctly.

  • 411-417: The change from batched: false to batched: true for the second test case is also consistent with the new batch processing behavior. As with the first hunk, ensure that the corresponding test cases and application logic are updated to handle this change correctly.

utsabc
utsabc previously approved these changes Nov 27, 2023
@aashishmalik aashishmalik changed the title feat: cm360 transformer proxy v1 feat: cm360 router batching Nov 30, 2023
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (571dbf5) 87.25% compared to head (db59918) 87.26%.

❗ Current head db59918 differs from pull request most recent head d126f95. Consider uploading reports for the commit d126f95 to get more accurate results

Files Patch % Lines
src/v0/destinations/campaign_manager/transform.js 95.91% 2 Missing ⚠️
src/services/destination/postTransformation.ts 66.66% 1 Missing ⚠️
...v0/destinations/campaign_manager/networkHandler.js 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2836   +/-   ##
========================================
  Coverage    87.25%   87.26%           
========================================
  Files          775      775           
  Lines        28869    28921   +52     
  Branches      6780     6789    +9     
========================================
+ Hits         25189    25237   +48     
- Misses        3340     3344    +4     
  Partials       340      340           

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

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

90.5% 90.5% Coverage
14.3% 14.3% Duplication

@aashishmalik aashishmalik merged commit 4b260e4 into develop Nov 30, 2023
14 checks passed
anantjain45823 pushed a commit that referenced this pull request Dec 1, 2023
* fix: timestamp microseconds input cm360

* feat: batching in cm360

* chore: addressed comments

* chore: addressed comments

* fix: return aborted inside cath block

* feat: update batching partial events

* feat: update batching partial events

* feat: update batching partial events

* feat: update batching partial events

* chore: removed hardcoded response

* feat: added new error class

* chore: develop merge

* feat: handle metadata as obj

* feat: handle metadata as obj

* chore: removed commented code

* fix: merged develop

* fix: merged develop

* chore: added tests for batching

* chore: added tests for batching
@devops-github-rudderstack devops-github-rudderstack deleted the feat.cm360-proxyV1 branch March 1, 2024 01:26
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