Alerting: Add tracking for the mode used in query and notifications step when c… (#100824)

Add tracking for the mode used in query and notifications step when creating a grafana rule
This commit is contained in:
Sonia Aguilar
2025-02-17 18:09:02 +02:00
committed by GitHub
parent 27837ee937
commit 3bb3a74ac1
2 changed files with 10 additions and 3 deletions
@@ -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 = () => {
@@ -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(