[Synthetics] adjust alert id for synthetics (#157234)

## Summary

Resolves https://github.com/elastic/kibana/issues/152773

Uses the `idWithLocation` value as the unique id for a monitor alert.

Given that we use uuid's for monitor config ids, this id should be
unique enough for any given monitor.

## Release note

All monitor status alerts for the Synthetics app that are active at the
time of upgrading will be resolved. A new alert will be created in its
place.
This commit is contained in:
Dominique Clarke 2023-05-10 21:34:51 -04:00 committed by GitHub
parent 4150ca4675
commit 1dbf3bb071
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,6 @@ import {
ALERT_DETAILS_URL,
VIEW_IN_APP_URL,
} from '../../legacy_uptime/lib/alerts/action_variables';
import { getInstanceId } from '../../legacy_uptime/lib/alerts/status_check';
import { UMServerLibs } from '../../legacy_uptime/uptime_server';
import { SyntheticsMonitorClient } from '../../synthetics_service/synthetics_monitor/synthetics_monitor_client';
import { UptimeRuleTypeAlertDefinition } from '../../legacy_uptime/lib/alerts/common';
@ -92,7 +91,7 @@ export const registerSyntheticsStatusCheckRule = (
Object.entries(downConfigs).forEach(([idWithLocation, { ping, configId }]) => {
const locationId = statusRule.getLocationId(ping.observer?.geo?.name!) ?? '';
const monitorSummary = getMonitorSummary(ping, DOWN_LABEL, locationId, configId);
const alertId = getInstanceId(ping, idWithLocation);
const alertId = idWithLocation;
const alert = alertWithLifecycle({
id: alertId,
fields: getMonitorAlertDocument(monitorSummary),