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(anomaly detection): add chart preview to new alert form #78238

Merged
merged 31 commits into from
Oct 15, 2024

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Sep 26, 2024

Adds anomaly chart visualization to new alert form (ruleForm.tsx + <TriggersChart />).

anomaly-preview

Related PRs:

Closes https://getsentry.atlassian.net/browse/ALRT-289

Context

In order to render the preview chart, we need to send the current dataset and 28 days of historical context to Seer for processing. In an ideal world, the backend would manage this for us, but there are technical constraints which make this unworkable.

I opted to implement this logic as unobtrusively as possible rather than taking on a large refactor. This PR extends the existing declarative <EndpointRequest /> pattern to fetch any historical data, which is then passed to the /organization/org-slug/events/anomalies/ endpoint via this.api.

Is this ideal? Absolutely not! I am looking forward to refactoring this form to FC + useApiQuery as part of the upcoming Alerts Create Issues effort.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 26, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 56.55738% with 53 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
static/app/views/alerts/rules/metric/ruleForm.tsx 57.69% 22 Missing ⚠️
...views/alerts/rules/metric/triggers/chart/index.tsx 22.72% 17 Missing ⚠️
...p/views/alerts/rules/metric/utils/anomalyChart.tsx 72.09% 12 Missing ⚠️
.../alerts/rules/metric/details/metricChartOption.tsx 60.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #78238       +/-   ##
===========================================
+ Coverage   52.26%   78.30%   +26.03%     
===========================================
  Files        7106     7132       +26     
  Lines      312658   314001     +1343     
  Branches    51071    51275      +204     
===========================================
+ Hits       163416   245863    +82447     
+ Misses     147648    61716    -85932     
- Partials     1594     6422     +4828     

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

mostly just comments about the prop drilling for anomalies and hoping we can create a context. if that's out of scope and want to take it on with ACI, that's cool too.

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

JS / reasoning behind implementation sounds good to me - i'd recommend having someone on anomaly detection do a quick pass to make sure the UI / features are working as expected.

@natemoo-re natemoo-re force-pushed the natemoo-re/anomaly-detection-charts branch from 0533d60 to f2f8e66 Compare October 9, 2024 16:18
@natemoo-re natemoo-re force-pushed the natemoo-re/anomaly-detection-charts branch from 0531e73 to 729154a Compare October 9, 2024 16:46
@natemoo-re natemoo-re force-pushed the natemoo-re/anomaly-detection-charts branch from 5ff096c to 0f466cc Compare October 9, 2024 17:06
@natemoo-re natemoo-re changed the title feat(anomaly detection): add anomaly chart preview to new alert feat(anomaly detection): add chart preview to new alert form Oct 9, 2024
@natemoo-re natemoo-re force-pushed the natemoo-re/anomaly-detection-charts branch from bbdcb4f to 0163b78 Compare October 9, 2024 18:10
@natemoo-re natemoo-re merged commit cddb224 into master Oct 15, 2024
43 of 44 checks passed
@natemoo-re natemoo-re deleted the natemoo-re/anomaly-detection-charts branch October 15, 2024 16:43
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants