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

chore (anomaly detection): create proxy API endpoint #76934

Merged
merged 4 commits into from
Sep 4, 2024

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Sep 4, 2024

Create a proxy API endpoint for us to query the backend about anomalies. get_historical_anomaly_data_from_seer returns a placeholder.

@mifu67 mifu67 requested review from a team as code owners September 4, 2024 17:20
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 4, 2024
@mifu67 mifu67 marked this pull request as draft September 4, 2024 17:24
@mifu67 mifu67 force-pushed the mifu67/detect_anomaly_proxy_endpoint branch from 77ae738 to c39b111 Compare September 4, 2024 17:24
@mifu67 mifu67 marked this pull request as ready for review September 4, 2024 17:24
Copy link
Contributor

@nhsiehgit nhsiehgit left a comment

Choose a reason for hiding this comment

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

bunch of non blocking nits


anomalies = get_historical_anomaly_data_from_seer(alert_rule, project, start, end)
if anomalies is None:
return Response("Unable to get historical anomaly data", status=400)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe lets add a note here to call out None is only hit when the seer response is bad
but if there are no anomalies, we'll get an empty array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there are fewer than seven days of event data, return an empty array. Otherwise, we get an array of labeled "anomalies" (these are potential anomalies that have been evaluated by Seer)

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 90.58824% with 8 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...nts/endpoints/organization_alert_rule_anomalies.py 84.61% 3 Missing and 3 partials ⚠️
src/sentry/seer/anomaly_detection/utils.py 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #76934      +/-   ##
==========================================
- Coverage   78.22%   78.22%   -0.01%     
==========================================
  Files        6898     6900       +2     
  Lines      306690   306747      +57     
  Branches    50276    50283       +7     
==========================================
+ Hits       239913   239955      +42     
- Misses      60415    60429      +14     
- Partials     6362     6363       +1     

@mifu67 mifu67 force-pushed the mifu67/detect_anomaly_proxy_endpoint branch from 1a352bb to 6eba640 Compare September 4, 2024 23:04
@mifu67 mifu67 enabled auto-merge (squash) September 4, 2024 23:37
@mifu67 mifu67 merged commit 9425d73 into master Sep 4, 2024
49 checks passed
@mifu67 mifu67 deleted the mifu67/detect_anomaly_proxy_endpoint branch September 4, 2024 23:40
@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants