-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Charts #76889
Anomaly Charts #76889
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #76889 +/- ##
==========================================
- Coverage 78.22% 78.22% -0.01%
==========================================
Files 6898 6899 +1
Lines 306690 306718 +28
Branches 50276 50282 +6
==========================================
- Hits 239919 239918 -1
- Misses 60416 60445 +29
Partials 6355 6355 |
depends on #76934 |
5b9fede
to
eaee356
Compare
let start; | ||
let end; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start and end could use some types
let start; | |
let end; | |
let start: string | undefined = undefined; | |
let end: string | undefined = undefined; |
const {anomaly, timestamp} = anomalyts; | ||
|
||
if ( | ||
[AnomalyType.high, AnomalyType.low].indexOf(anomaly.anomaly_type as string) > -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit using includes instead of -1 indexof
[AnomalyType.high, AnomalyType.low].indexOf(anomaly.anomaly_type as string) > -1 | |
[AnomalyType.high, AnomalyType.low].includes(anomaly.anomaly_type as string) |
if (!start) { | ||
start = new Date(timestamp).toISOString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a comment here might help the next person, like what does it mean to not have the start here or when does that happen
@@ -355,6 +403,72 @@ export function getMetricAlertChartOption({ | |||
}); | |||
} | |||
|
|||
if (anomalies) { | |||
const anomalyBlocks: any[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anomalyBlocks could use a better type
const anomalyBlocks: any[] = []; | |
const anomalyBlocks: any[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof ok.
this was way too hairy.
not gonna bother typing this 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be MarkAreaComponentOption['data']
fetchIncidentsForRule(organization.slug, ruleId, start, end), | ||
rulePromise, | ||
]); | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inserting it into the array can avoid using Promise and it should infer the types
]; | |
organization.features.includes('anomaly-detection-alerts') ? fetchAnomaliesForRule(organization.slug, ruleId, start, end) : undefined | |
]; |
e6429c0
to
b719fdf
Compare
const {anomaly, timestamp} = anomalyts; | ||
|
||
if ( | ||
[AnomalyType.high, AnomalyType.low].includes(anomaly.anomaly_type as string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its not merged yet anomalyType would be preferred but we miss this quite a bit in various endpoints
[AnomalyType.high, AnomalyType.low].includes(anomaly.anomaly_type as string) | |
[AnomalyType.high, AnomalyType.low].includes(anomaly.anomalyType as string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.
actually, would be dependent on the API response i guess.
I won't merge this until i've verified the api response
edbf76b
to
1508d20
Compare
Bundle ReportChanges will increase total bundle size by 26.71kB ⬆️
|
<img width="92" alt="Screenshot 2024-09-05 at 3 52 14 PM" src="https://github.com/user-attachments/assets/8ecf4050-9c00-4fe5-9828-0605a6ea6b4a"> we now have anomaly lines rendering in chartcuterie charts! follow up to #76889
highlights the alert rule details chart if an anomaly is detected Added a dashed line to highlight when the anomaly started and removed the label at the top of the chart <img width="512" alt="Screenshot 2024-09-03 at 3 18 23 PM" src="https://github.com/user-attachments/assets/3a1a04a1-f8a0-4325-8989-f9b9f61d974a"> <img width="284" alt="Screenshot 2024-09-03 at 3 21 35 PM" src="https://github.com/user-attachments/assets/0013642a-cbf1-488e-b88f-739cc2f92256">
<img width="92" alt="Screenshot 2024-09-05 at 3 52 14 PM" src="https://github.com/user-attachments/assets/8ecf4050-9c00-4fe5-9828-0605a6ea6b4a"> we now have anomaly lines rendering in chartcuterie charts! follow up to #76889
highlights the alert rule details chart if an anomaly is detected
Added a dashed line to highlight when the anomaly started
and removed the label at the top of the chart