Skip to content

feat: remove CDK compare test logic and metrics - #4541

Merged
koladilip merged 1 commit into
developfrom
feat/remove-cdk-compare-test-logic
Aug 1, 2025
Merged

koladilip merged 1 commit into
developfrom
feat/remove-cdk-compare-test-logic

Conversation

@koladilip

@koladilip koladilip commented Jul 29, 2025 •

Copy link
Copy Markdown
Contributor

This PR removes unused CDK compare test logic and metrics to improve maintainability and reduce Prometheus cardinality.

Changes:

  • Remove ComparatorService and comparison logic
  • Remove CDK live compare test metrics (3 counters)
  • Remove CDK transformation time metrics (2 gauges/histograms)
  • Simplify ServiceSelector to remove comparator logic
  • Remove comparator-related tests and types
  • Update constants to remove comparator service reference
  • Resolves INT-3985
    Benefits:
  • Reduced Prometheus cardinality by removing 7 unused metrics
  • Simplified codebase by removing ~400 lines of unused code
  • Improved performance and maintainability
  • No breaking changes - all existing tests pass

Risk Assessment: Low risk - all removed code was unused in production

- Remove ComparatorService and related comparison logic
- Remove CDK live compare test metrics from Prometheus
- Remove CDK transformation time and events latency metrics
- Simplify ServiceSelector to remove comparator logic
- Remove comparator-related tests and types
- Update constants to remove comparator service reference
- Reduce Prometheus cardinality by removing 7 unused metrics
- Improve code maintainability and performance
@koladilip
koladilip requested review from a team and sivashanmukh as code owners July 29, 2025 15:44
@koladilip
koladilip requested review from a team, ItsSudip and vinayteki95 July 29, 2025 15:44
@coderabbitai

coderabbitai Bot commented Jul 29, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Removed all support for comparator-based service selection and related logic, simplifying service selection to always use the primary destination service.
    • Eliminated the comparator service and its associated configuration options.
    • Removed metrics and monitoring related to live comparison testing.
    • Cleaned up related constants and type definitions.

Walkthrough

This change set removes all logic, code, and metrics related to the ComparatorService and live comparison testing between destination services. The ServiceSelector is simplified to select only the primary service, comparator-specific constants and types are deleted, and associated Prometheus metrics are removed.

Changes

Cohort / File(s) Change Summary
ServiceSelector Simplification
src/helpers/serviceSelector.ts
Eliminated all comparator logic from the ServiceSelector class, including related private methods and the ComparatorService import. The destination service selection now returns only the primary service, with no fallback or comparison logic.
Constants Cleanup
src/routes/utils/constants.js
Removed the COMPARATOR property from the exported INTEGRATION_SERVICE constant.
ComparatorService Removal
src/services/comparator.ts
Deleted the entire ComparatorService class, which previously enabled live output comparison between primary and secondary destination services for transformation and delivery operations. All related public methods and logic are removed.
Type Deletion
src/types/destinationTransformation.ts
Removed the ComparatorInput type alias, which defined the input structure for comparator-based transformations.
Prometheus Metrics Cleanup
src/util/prometheus.js
Removed all metrics related to comparator testing and transformation time, including three counters (cdk_live_compare_test_failed, cdk_live_compare_test_success, cdk_live_compare_test_errored), one gauge (cdk_transformation_time), and one histogram (cdk_events_latency). No other metric logic was changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • sivashanmukh
  • utsabc
  • krishna2020

Suggestions for improvement:

  • Ensure that all documentation and deployment scripts referencing the comparator or related metrics are updated accordingly.
  • Validate that monitoring and alerting systems are adjusted to account for the removal of these Prometheus metrics.
  • Consider adding regression tests to confirm that the new, simplified service selection logic behaves as expected.

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 ffa880c and b8612fb.

⛔ Files ignored due to path filters (1)
  • test/apitests/service.api.test.ts is excluded by !**/test/**
📒 Files selected for processing (5)
  • src/helpers/serviceSelector.ts (1 hunks)
  • src/routes/utils/constants.js (0 hunks)
  • src/services/comparator.ts (0 hunks)
  • src/types/destinationTransformation.ts (0 hunks)
  • src/util/prometheus.js (3 hunks)
💤 Files with no reviewable changes (3)
  • src/routes/utils/constants.js
  • src/types/destinationTransformation.ts
  • src/services/comparator.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit Configuration File

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

Files:

  • src/util/prometheus.js
⏰ 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: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • 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: Code Coverage
  • GitHub Check: UT Tests
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/helpers/serviceSelector.ts (1)

59-63: Clean simplification of service selection logic.

The removal of comparator logic effectively simplifies the getDestinationService method to always return the primary destination service. This aligns perfectly with the PR objective to eliminate unused CDK compare test functionality.

src/util/prometheus.js (2)

220-972: Metrics cleanup successfully reduces Prometheus cardinality.

The removal of CDK comparison testing metrics (counters for test results, transformation time gauge, and events latency histogram) effectively reduces the Prometheus cardinality as intended. The metrics array structure remains well-organized and properly formatted after the cleanup.


220-972: Complete removal of CDK comparator metrics verified

Ripgrep scans across all JS/TS files found no occurrences of the removed metrics (cdk_live_compare_test_*, cdk_transformation_time, cdk_events_latency) or any other comparator-related patterns. The cleanup in src/util/prometheus.js is complete.

Suggestions for future-proofing:

  • Update the CHANGELOG or release notes to document these metric removals.
  • Consider adding a lint rule or unit test to flag deprecated metric names and prevent accidental reintroduction.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/remove-cdk-compare-test-logic

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.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Jul 29, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.73%. Comparing base (56f4d36) to head (b8612fb).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4541      +/-   ##
===========================================
+ Coverage    91.57%   91.73%   +0.16%     
===========================================
  Files          639      638       -1     
  Lines        33786    33649     -137     
  Branches      7988     7964      -24     
===========================================
- Hits         30940    30869      -71     
+ Misses        2588     2528      -60     
+ Partials       258      252       -6     

☔ 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

Copy link
Copy Markdown

@ItsSudip ItsSudip self-assigned this Aug 1, 2025
@koladilip
koladilip merged commit 94f48e1 into develop Aug 1, 2025
@koladilip
koladilip deleted the feat/remove-cdk-compare-test-logic branch August 1, 2025 08:52
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.

4 participants