Skip to content

Commit afc0909

Browse files
authored
feat(form): Trigger Feedback Form on Negative Feedback (#80438)
- Trigger feedback form when an anomaly is reported as incorrect
1 parent 671e07c commit afc0909

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

static/app/views/alerts/rules/metric/details/anomalyDetectionFeedbackBanner.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ConfigStore from 'sentry/stores/configStore';
1010
import {space} from 'sentry/styles/space';
1111
import type {Organization} from 'sentry/types/organization';
1212
import {trackAnalytics} from 'sentry/utils/analytics';
13+
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
1314
import type {Incident} from 'sentry/views/alerts/types';
1415

1516
interface AnomalyDetectionFeedbackProps {
@@ -24,6 +25,7 @@ export default function AnomalyDetectionFeedbackBanner({
2425
selectedIncident,
2526
}: AnomalyDetectionFeedbackProps) {
2627
const [isSubmitted, submit] = useDismissable(id);
28+
const openFeedbackForm = useFeedbackForm();
2729

2830
const handleClick = useCallback(
2931
(anomalyCorrectlyIdentified: boolean) => {
@@ -50,6 +52,15 @@ export default function AnomalyDetectionFeedbackBanner({
5052
level: 'info',
5153
message: 'Anomaly Detection Alerts Banner Feedback',
5254
});
55+
if (!anomalyCorrectlyIdentified && openFeedbackForm) {
56+
openFeedbackForm({
57+
messagePlaceholder: t('Why was this anomaly incorrect?'),
58+
tags: {
59+
['feedback.source']: 'anomaly_detection_false_positive',
60+
['feedback.owner']: 'ml-ai',
61+
},
62+
});
63+
}
5364
submit();
5465
},
5566
[
@@ -61,6 +72,7 @@ export default function AnomalyDetectionFeedbackBanner({
6172
selectedIncident.alertRule.thresholdType,
6273
selectedIncident.alertRule.timeWindow,
6374
submit,
75+
openFeedbackForm,
6476
]
6577
);
6678

0 commit comments

Comments
 (0)