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

Anomaly Detection: Unit and Integration Tests #1146

Merged
merged 54 commits into from
Sep 13, 2024

Conversation

aayush-se
Copy link
Member

  • Generated Synthetic timeseries (cyclical, cyclical with anomaly, noisy, noisy with anomaly) to use for unit and integration tests

    • Timeseries generated indata-analysis GitHub repo
  • Wrote unit tests for the following modules in anomaly_detection:

    • Detectors
      • anomaly_detectors.py
      • mp_config.py
      • mp_scorers.py
      • mp_utils.py
      • normalizers.py
      • window_size_selctors.py
    • Models
      • converters.py
      • timeseries_anomalies.py
      • timeseries.py

Wrote integration tests for the store and detect endpoints for batch, stream, and combo pipelines

NOTE: Wanted to submit this PR to start getting some feedback as there are a lot of changes. As of submitting this PR, the following unit/integration tests do not work and I wanted to get some feedback:

  • test_detect_anomalies_online in test_anomaly_detection.py: Was unsure how to handle database changes during integration test
  • test_detect in test_anomaly_detectors.py: was running into shape errors with the matrix profile
  • test_incorrect_padding in test_mp_utils.py: this one is fixed as of this PR so needs to be merged into main to reflect changes

@aayush-se aayush-se requested a review from a team September 10, 2024 06:10
@aayush-se aayush-se changed the title Anomaly detection/unit tests Anomaly Detection: Unit and Integration Tests Sep 10, 2024
)

# Successful
self.assertEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

assert response == X

sentry-autofix bot and others added 15 commits September 10, 2024 11:44
👋 Hi there! This PR was automatically generated by Autofix 🤖

This fix was triggered by Jenn Mueng

Fixes
[SEER-9R](https://sentry.io/organizations/sentry/issues/5734622145/)

This change updates the `ThreadDetails` model in the
`src/seer/automation/models.py` file. Specifically, it modifies the `id`
field to be optional by setting its default value to `None`.
Additionally, a blank line has been added before the class definition
for better readability.

If you have any questions or feedback for the Sentry team about this
fix, please email [autofix@sentry.io](mailto:autofix@sentry.io) with the
Run ID (see below).

### 🤓 Stats for the nerds:
Run ID: **738**
Prompt tokens: **97008**
Completion tokens: **5084**
Total tokens: **102092**

---------

Co-authored-by: sentry-autofix-experimental[bot] <157164994+sentry-autofix-experimental[bot]@users.noreply.github.com>
Co-authored-by: jenn.muengtaweepongsa <jenn.muengtaweepongsa@sentry.io>
…ion errors (#1111)

Some issues don't have all the breadcrumbs fields, so we make them
optional now.
Mainly for the staging deployment in `ml-ai`

Introduces an `ENFORCE_API_AUTH` env variable that will enforce either
the rpc secret signing or the bearer token.
…stead of response (#1108)

This PR includes:

1. Changing the issue summary storage logic to store the raw output
`IssueSummary` from GPT, rather than the trimmed
`SummarizeIssueResponse` as before. The extra info, such as
`reason_step_by_step` is useful.
2. Pass the issue summary to Autofix as additional context. (part of
#998) Remove pre-processing step on event details as well. Improvement
in evals: 0.48/0.52 -> 0.51/0.55
3. Allow optional issue summary in `AutofixRequest` to support new eval
dataset
#1112)

The job to delete old Autofix runs failed when there was a PR mapped to
it. This PR adds a cascade delete so that it works.
https://sentry.sentry.io/issues/5764875740/?project=6178942&query=is:unresolved%20issue.priority:%5Bhigh,%20medium%5D&statsPeriod=14d&stream_index=4

It also adds on to the job to delete old Issue Summaries for the TTL.

Issue #1116
Need to clean up existing test data before applying db migration to fix
[SEER-A9](https://sentry.sentry.io/issues/5797165799)
- Set up upper bound to avoid `window_size` overflow when hitting
`_score()` (upper limit is np.integer max size which is 2**63 - 1)
- Write basic unit tests to confirm functionality
Switches coding agent to Claude (#951)

Evals: 0.51/0.55 -> 0.54/0.61 (huge bump!)

Note: don't deploy this until Sept 5, 2024
@aayush-se
Copy link
Member Author

Reverted changes -- improperly merged from main. Will updated changes from comments again.

@aayush-se aayush-se merged commit 84ed952 into main Sep 13, 2024
11 checks passed
@aayush-se aayush-se deleted the anomaly-detection/unit-tests branch September 13, 2024 16:08
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.

5 participants