Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RAC][Observability] preserve lifecycle alert changes for active alerts #110124

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,17 @@ export const createLifecycleExecutor = (

const allAlertIds = [...new Set(currentAlertIds.concat(trackedAlertIds))];

const trackedAlertStatesOfRecovered = Object.values(state.trackedAlerts).filter(
(trackedAlertState) => !currentAlerts[trackedAlertState.alertId]
);
const trackedAlertStates = Object.values(state.trackedAlerts);

logger.debug(
`Tracking ${allAlertIds.length} alerts (${newAlertIds.length} new, ${trackedAlertStatesOfRecovered.length} recovered)`
`Tracking ${allAlertIds.length} alerts (${newAlertIds.length} new, ${trackedAlertStates.length} previous)`
);

const alertsDataMap: Record<string, Partial<ParsedTechnicalFields>> = {
...currentAlerts,
};

if (trackedAlertStatesOfRecovered.length) {
if (trackedAlertStates.length) {
const { hits } = await ruleDataClient.getReader().search({
body: {
query: {
Expand All @@ -203,15 +201,15 @@ export const createLifecycleExecutor = (
},
{
terms: {
[ALERT_UUID]: trackedAlertStatesOfRecovered.map(
[ALERT_UUID]: trackedAlertStates.map(
(trackedAlertState) => trackedAlertState.alertUuid
),
},
},
],
},
},
size: trackedAlertStatesOfRecovered.length,
size: trackedAlertStates.length,
collapse: {
field: ALERT_UUID,
},
Expand Down