Skip to content

Conversation

@nikhil-zlai
Copy link
Contributor

@nikhil-zlai nikhil-zlai commented Dec 5, 2024

Summary

The summary logic assigns labels incorrectly. This PR fixes the issue

I had to copy some code into the drift test to get the whole logic running end-to-end. Ideally move the elements of drift test into TimeseriesControllerSpec. But we should do that in a later PR

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new method for generating percentage breaks in the DriftStore.
  • Improvements

    • Enhanced error handling for time series data retrieval and deserialization.
    • Refactored logic for fetching and processing summary series to improve efficiency and clarity.
  • Bug Fixes

    • Updated percentile data generation logic in tests to align with timestamp counts.
  • Tests

    • Improved asynchronous handling in the DriftTest class for summary series retrieval.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The changes in this pull request involve significant enhancements to the TimeSeriesController, DriftStore, and DriftTest classes. Modifications include improved error handling, refactoring of data transformation logic, and the introduction of new methods to facilitate better data processing and retrieval. The DriftTest class has transitioned to an asynchronous model for fetching summary series, and several new case classes and traits have been added to structure the data more effectively. Overall, the changes aim to enhance clarity, robustness, and efficiency in handling time series data.

Changes

File Path Change Summary
hub/app/controllers/TimeSeriesController.scala Updated import statements; refactored convertTileSummarySeriesToTimeSeries for better handling of percentile and histogram data; enhanced error handling in doFetchJoinDrift and doFetchFeatureDrift.
online/src/main/scala/ai/chronon/online/stats/DriftStore.scala Enhanced error handling in getSummaries and getSummariesForRange; added new method breaks to generate percentage breaks; improved query construction logic.
spark/src/test/scala/ai/chronon/spark/test/stats/drift/DriftTest.scala Added new imports; refactored test case for asynchronous processing of summary series; introduced new case classes and traits for data structure; added methods for numeric checks and conversions.

Possibly related PRs

Suggested reviewers

  • piyush-zlai
  • ken-zlai

Poem

In the fields where data flows,
A rabbit hops where knowledge grows.
With clearer paths and errors tamed,
Our time series now are famed!
So let us cheer, both near and far,
For every change, a shining star! ✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between deeb85e and 7cdd4ae.

📒 Files selected for processing (1)
  • hub/test/controllers/TimeSeriesControllerSpec.scala (1 hunks)
🔇 Additional comments (1)
hub/test/controllers/TimeSeriesControllerSpec.scala (1)

300-302: LGTM! The percentile data generation logic is now correctly aligned.

The change to use DriftStore.breaks(20).map ensures that the test data generation matches the actual implementation, with the correct number of percentile entries per timestamp. This aligns with the PR objective of fixing the summary logic.

Let's verify the test coverage for edge cases:

✅ Verification successful

Let me gather more information about the test coverage, particularly focusing on the TimeSeriesController tests.


Let me check the test file directly to understand the test coverage better.


The test coverage for percentile data generation is comprehensive and correctly implemented.

The changes to use DriftStore.breaks(20) in the test data generation are well-aligned with the codebase's implementation. The test file includes:

  • Verification of the correct number of percentile entries (DriftStore.breaks(20).length * expectedHours)
  • Test cases for both numeric and categorical features
  • Validation of the response structure and data consistency
  • Edge case handling through the mock data generation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if there are tests covering edge cases for percentile data

# Look for test cases handling empty breaks or timestamps
rg -A 5 "breaks.*empty|timestamps.*empty" --type scala

# Look for test cases handling null values
rg -A 5 "setPercentiles.*null|percentileList.*null" --type scala

# Look for test cases with different break sizes
rg -A 5 "breaks\([^2]|breaks\([1-9][^0]" --type scala

Length of output: 3009


Script:

#!/bin/bash
# Look for test cases in TimeSeriesControllerSpec that might handle edge cases
rg -A 10 "\"generateSummarySeries\"" hub/test/controllers/TimeSeriesControllerSpec.scala

# Check the implementation of DriftStore.breaks to understand the validation
cat online/src/main/scala/ai/chronon/online/stats/DriftStore.scala

# Look for any error handling tests around percentile data
rg -A 5 "should.*fail|should.*throw|should.*error.*percentile" --type scala hub/test/

Length of output: 8767


Script:

#!/bin/bash
# Get the content of TimeSeriesControllerSpec to analyze test coverage
cat hub/test/controllers/TimeSeriesControllerSpec.scala

# Look for any test cases with DriftStore.breaks in the entire codebase
rg -A 5 "DriftStore\.breaks" --type scala

Length of output: 16739


🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

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.

@ken-zlai ken-zlai self-requested a review December 5, 2024 22:15
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.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 60c30cb and deeb85e.

📒 Files selected for processing (3)
  • hub/app/controllers/TimeSeriesController.scala (2 hunks)
  • online/src/main/scala/ai/chronon/online/stats/DriftStore.scala (0 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/stats/drift/DriftTest.scala (4 hunks)
💤 Files with no reviewable changes (1)
  • online/src/main/scala/ai/chronon/online/stats/DriftStore.scala

Copy link
Contributor

@ken-zlai ken-zlai left a comment

Choose a reason for hiding this comment

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

Works great for me in my testing. Most categorical data has the same current and baseline values, but I've found a few where they differ. It doesn't seem to correlate as closely to drift as the numerical data in the charts, but its something we can refine in the future

Copy link
Contributor

@piyush-zlai piyush-zlai left a comment

Choose a reason for hiding this comment

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

Thanks for catching and fixing!

@nikhil-zlai nikhil-zlai merged commit 6c4ebbc into main Dec 7, 2024
8 checks passed
@nikhil-zlai nikhil-zlai deleted the summary_fix branch December 7, 2024 21:52
@coderabbitai coderabbitai bot mentioned this pull request Dec 21, 2024
4 tasks
kumar-zlai pushed a commit that referenced this pull request Apr 25, 2025
## Summary
The summary logic assigns labels incorrectly. This PR fixes the issue

I had to copy some code into the drift test to get the whole logic
running end-to-end. Ideally move the elements of drift test into
`TimeseriesControllerSpec`. But we should do that in a later PR


## Checklist
- [x] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced a new method for generating percentage breaks in the
DriftStore.
  
- **Improvements**
- Enhanced error handling for time series data retrieval and
deserialization.
- Refactored logic for fetching and processing summary series to improve
efficiency and clarity.

- **Bug Fixes**
- Updated percentile data generation logic in tests to align with
timestamp counts.

- **Tests**
- Improved asynchronous handling in the DriftTest class for summary
series retrieval.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
kumar-zlai pushed a commit that referenced this pull request Apr 29, 2025
## Summary
The summary logic assigns labels incorrectly. This PR fixes the issue

I had to copy some code into the drift test to get the whole logic
running end-to-end. Ideally move the elements of drift test into
`TimeseriesControllerSpec`. But we should do that in a later PR


## Checklist
- [x] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced a new method for generating percentage breaks in the
DriftStore.
  
- **Improvements**
- Enhanced error handling for time series data retrieval and
deserialization.
- Refactored logic for fetching and processing summary series to improve
efficiency and clarity.

- **Bug Fixes**
- Updated percentile data generation logic in tests to align with
timestamp counts.

- **Tests**
- Improved asynchronous handling in the DriftTest class for summary
series retrieval.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary
The summary logic assigns labels incorrectly. This PR fixes the issue

I had to copy some code into the drift test to get the whole logic
running end-to-end. Ideally move the elements of drift test into
`TimeseriesControllerSpec`. But we should do that in a later PR


## Checklist
- [x] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced a new method for generating percentage breaks in the
DriftStore.
  
- **Improvements**
- Enhanced error handling for time series data retrieval and
deserialization.
- Refactored logic for fetching and processing summary series to improve
efficiency and clarity.

- **Bug Fixes**
- Updated percentile data generation logic in tests to align with
timestamp counts.

- **Tests**
- Improved asynchronous handling in the DriftTest class for summary
series retrieval.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 16, 2025
## Summary
The summary logic assigns labels incorrectly. This PR fixes the issue

I had to copy some code into the drift test to get the whole logic
running end-to-end. Ideally move the elements of drift test into
`TimeseriesControllerSpec`. But we should do that in a later PR


## Cheour clientslist
- [x] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced a new method for generating percentage breaks in the
DriftStore.
  
- **Improvements**
- Enhanced error handling for time series data retrieval and
deserialization.
- Refactored logic for fetching and processing summary series to improve
efficiency and clarity.

- **Bug Fixes**
- Updated percentile data generation logic in tests to align with
timestamp counts.

- **Tests**
- Improved asynchronous handling in the DriftTest class for summary
series retrieval.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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