mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add interactions for Fullstory (#94631)
add interactions for Fullstory
This commit is contained in:
parent
19a9a79467
commit
0dd5373e4a
@ -190,6 +190,18 @@ export const trackAlertRuleFormError = (
|
||||
reportInteraction('grafana_alerting_rule_form_error', props);
|
||||
};
|
||||
|
||||
export const trackNewGrafanaAlertRuleFormSavedSuccess = () => {
|
||||
reportInteraction('grafana_alerting_grafana_rule_creation_new_success');
|
||||
};
|
||||
|
||||
export const trackNewGrafanaAlertRuleFormCancelled = () => {
|
||||
reportInteraction('grafana_alerting_grafana_rule_creation_new_aborted');
|
||||
};
|
||||
|
||||
export const trackNewGrafanaAlertRuleFormError = () => {
|
||||
reportInteraction('grafana_alerting_grafana_rule_creation_new_error');
|
||||
};
|
||||
|
||||
export const trackInsightsFeedback = async (props: { useful: boolean; panel: string }) => {
|
||||
const defaults = {
|
||||
grafana_version: config.buildInfo.version,
|
||||
|
@ -29,6 +29,9 @@ import {
|
||||
trackAlertRuleFormCancelled,
|
||||
trackAlertRuleFormError,
|
||||
trackAlertRuleFormSaved,
|
||||
trackNewGrafanaAlertRuleFormCancelled,
|
||||
trackNewGrafanaAlertRuleFormError,
|
||||
trackNewGrafanaAlertRuleFormSavedSuccess,
|
||||
} from '../../../Analytics';
|
||||
import { shouldUsePrometheusRulesPrimary } from '../../../featureToggles';
|
||||
import { useDeleteRuleFromGroup } from '../../../hooks/ruleGroup/useDeleteRuleFromGroup';
|
||||
@ -138,6 +141,10 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => {
|
||||
const submit = async (values: RuleFormValues, exitOnSave: boolean) => {
|
||||
if (conditionErrorMsg !== '') {
|
||||
notifyApp.error(conditionErrorMsg);
|
||||
if (!existing && grafanaTypeRule) {
|
||||
// new Grafana-managed rule
|
||||
trackNewGrafanaAlertRuleFormError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -154,6 +161,7 @@ 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
|
||||
} else {
|
||||
const ruleIdentifier = fromRulerRuleAndRuleGroupIdentifier(ruleGroupIdentifier, existing.rule);
|
||||
const targetRuleGroupIdentifier = getRuleGroupLocationFromFormValues(values);
|
||||
@ -207,6 +215,10 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => {
|
||||
const cancelRuleCreation = () => {
|
||||
logInfo(LogMessages.cancelSavingAlertRule);
|
||||
trackAlertRuleFormCancelled({ formAction: existing ? 'update' : 'create' });
|
||||
if (!existing && grafanaTypeRule) {
|
||||
// new Grafana-managed rule
|
||||
trackNewGrafanaAlertRuleFormCancelled();
|
||||
}
|
||||
locationService.getHistory().goBack();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user