mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
fix missing context for recovered burn rate rule alerts (#173505)
Fixes https://github.com/elastic/kibana/issues/173500
This commit is contained in:
parent
4d35abe9b6
commit
e3ef0c8c6c
1 changed files with 33 additions and 34 deletions
|
@ -98,7 +98,6 @@ export const getRuleExecutor = ({
|
|||
const alertLimit = alertFactory.alertLimit.getValue();
|
||||
let hasReachedLimit = false;
|
||||
let scheduledActionsCount = 0;
|
||||
|
||||
for (const result of results) {
|
||||
const {
|
||||
instanceId,
|
||||
|
@ -172,42 +171,42 @@ export const getRuleExecutor = ({
|
|||
scheduledActionsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
const { getRecoveredAlerts } = alertFactory.done();
|
||||
const recoveredAlerts = getRecoveredAlerts();
|
||||
for (const recoveredAlert of recoveredAlerts) {
|
||||
const alertId = recoveredAlert.getId();
|
||||
const indexedStartedAt = getAlertStartedDate(alertId) ?? startedAt.toISOString();
|
||||
const alertUuid = recoveredAlert.getUuid();
|
||||
const alertDetailsUrl = await getAlertUrl(
|
||||
alertUuid,
|
||||
spaceId,
|
||||
indexedStartedAt,
|
||||
alertsLocator,
|
||||
basePath.publicBaseUrl
|
||||
);
|
||||
|
||||
const urlQuery = alertId === ALL_VALUE ? '' : `?instanceId=${alertId}`;
|
||||
const viewInAppUrl = addSpaceIdToPath(
|
||||
basePath.publicBaseUrl,
|
||||
spaceId,
|
||||
`/app/observability/slos/${slo.id}${urlQuery}`
|
||||
);
|
||||
|
||||
const context = {
|
||||
timestamp: startedAt.toISOString(),
|
||||
viewInAppUrl,
|
||||
alertDetailsUrl,
|
||||
sloId: slo.id,
|
||||
sloName: slo.name,
|
||||
sloInstanceId: alertId,
|
||||
};
|
||||
|
||||
recoveredAlert.setContext(context);
|
||||
}
|
||||
alertFactory.alertLimit.setLimitReached(hasReachedLimit);
|
||||
}
|
||||
|
||||
const { getRecoveredAlerts } = alertFactory.done();
|
||||
const recoveredAlerts = getRecoveredAlerts();
|
||||
for (const recoveredAlert of recoveredAlerts) {
|
||||
const alertId = recoveredAlert.getId();
|
||||
const indexedStartedAt = getAlertStartedDate(alertId) ?? startedAt.toISOString();
|
||||
const alertUuid = recoveredAlert.getUuid();
|
||||
const alertDetailsUrl = await getAlertUrl(
|
||||
alertUuid,
|
||||
spaceId,
|
||||
indexedStartedAt,
|
||||
alertsLocator,
|
||||
basePath.publicBaseUrl
|
||||
);
|
||||
|
||||
const urlQuery = alertId === ALL_VALUE ? '' : `?instanceId=${alertId}`;
|
||||
const viewInAppUrl = addSpaceIdToPath(
|
||||
basePath.publicBaseUrl,
|
||||
spaceId,
|
||||
`/app/observability/slos/${slo.id}${urlQuery}`
|
||||
);
|
||||
|
||||
const context = {
|
||||
timestamp: startedAt.toISOString(),
|
||||
viewInAppUrl,
|
||||
alertDetailsUrl,
|
||||
sloId: slo.id,
|
||||
sloName: slo.name,
|
||||
sloInstanceId: alertId,
|
||||
};
|
||||
|
||||
recoveredAlert.setContext(context);
|
||||
}
|
||||
|
||||
return { state: {} };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue