From 3bb3a74ac14f8d0c0b6894f1aad6c6de9728e5ac Mon Sep 17 00:00:00 2001 From: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> Date: Mon, 17 Feb 2025 17:09:02 +0100 Subject: [PATCH] =?UTF-8?q?Alerting:=20Add=20tracking=20for=20the=20mode?= =?UTF-8?q?=20used=20in=20query=20and=20notifications=20step=20when=20c?= =?UTF-8?q?=E2=80=A6=20(#100824)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add tracking for the mode used in query and notifications step when creating a grafana rule --- public/app/features/alerting/unified/Analytics.ts | 7 +++++-- .../rule-editor/alert-rule-form/AlertRuleForm.tsx | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/app/features/alerting/unified/Analytics.ts b/public/app/features/alerting/unified/Analytics.ts index e873fe6abd2..25e7e973c83 100644 --- a/public/app/features/alerting/unified/Analytics.ts +++ b/public/app/features/alerting/unified/Analytics.ts @@ -194,8 +194,11 @@ export const trackAlertRuleFormError = ( reportInteraction('grafana_alerting_rule_form_error', props); }; -export const trackNewGrafanaAlertRuleFormSavedSuccess = () => { - reportInteraction('grafana_alerting_grafana_rule_creation_new_success'); +export const trackNewGrafanaAlertRuleFormSavedSuccess = (payload: { + simplifiedQueryEditor: boolean; + simplifiedNotificationEditor: boolean; +}) => { + reportInteraction('grafana_alerting_grafana_rule_creation_new_success', payload); }; export const trackNewGrafanaAlertRuleFormCancelled = () => { diff --git a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx index 3d46e0873e7..2a9846b0e62 100644 --- a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx @@ -156,7 +156,11 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => { // when creating a new rule, we save the manual routing setting , and editorSettings.simplifiedQueryEditor to the local storage storeInLocalStorageValues(values); await addRuleToRuleGroup.execute(ruleGroupIdentifier, ruleDefinition, evaluateEvery); - grafanaTypeRule && trackNewGrafanaAlertRuleFormSavedSuccess(); // new Grafana-managed rule + grafanaTypeRule && + trackNewGrafanaAlertRuleFormSavedSuccess({ + simplifiedQueryEditor: values.editorSettings?.simplifiedQueryEditor ?? false, + simplifiedNotificationEditor: values.editorSettings?.simplifiedNotificationEditor ?? false, + }); // new Grafana-managed rule } else { const ruleIdentifier = fromRulerRuleAndRuleGroupIdentifier(ruleGroupIdentifier, existing.rule); await updateRuleInRuleGroup.execute(