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

[ResponseOps] muted alert still fires when using notifyWhen: onActionGroupChange #124170

Closed
pmuellr opened this issue Jan 31, 2022 · 2 comments · Fixed by #124775
Closed

[ResponseOps] muted alert still fires when using notifyWhen: onActionGroupChange #124170

pmuellr opened this issue Jan 31, 2022 · 2 comments · Fixed by #124775
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@pmuellr
Copy link
Member

pmuellr commented Jan 31, 2022

We had a user report that an alert that they had muted was still firing it's actions. Note - the rule itself is not muted, just one specific alert instance. Looking at the event log, you can see that actions are being invoked for that alert, despite it be listed in the muted instances of the saved object. The rule is set to notifyWhen: onActionGroupChange. It seems like the easiest way to test this, given it's on an action group change, is to disable the rule, which will set the instances to "recovered", and the re-enable it, so that the next execution will fire all the instances (muted and not) because of the change from recovered -> active.

In the code below, you can see that the "false" path (second half) checks for throttled and muted cases, but the "true" path does not. So basically, throttling and muting are ignored when notifyWhen == onActionGroupChange.

const alertsToExecute =
notifyWhen === 'onActionGroupChange'
? Object.entries(alertsWithScheduledActions).filter(
([alertName, alert]: [string, AlertInstance<InstanceState, InstanceContext>]) => {
const shouldExecuteAction = alert.scheduledActionGroupOrSubgroupHasChanged();
if (!shouldExecuteAction) {
this.logger.debug(
`skipping scheduling of actions for '${alertName}' in rule ${ruleLabel}: alert is active but action group has not changed`
);
}
return shouldExecuteAction;
}
)
: Object.entries(alertsWithScheduledActions).filter(
([alertName, alert]: [string, AlertInstance<InstanceState, InstanceContext>]) => {
const throttled = alert.isThrottled(throttle);
const muted = mutedAlertIdsSet.has(alertName);
const shouldExecuteAction = !throttled && !muted;
if (!shouldExecuteAction) {
this.logger.debug(
`skipping scheduling of actions for '${alertName}' in rule ${ruleLabel}: rule is ${
muted ? 'muted' : 'throttled'
}`
);
}
return shouldExecuteAction;
}
);

@pmuellr pmuellr added bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework labels Jan 31, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@pmuellr
Copy link
Member Author

pmuellr commented Jan 31, 2022

I'm a little surprised by this one, since I believe notifyWhen: onActionGroupChange is the default, so you'd think this bug would show up more often. But thinking maybe it only really started happening when we started "recovering" the instances when the rule is disabled - from this PR #111671 merged in 7.16.0?

@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
@ersin-erdal ersin-erdal self-assigned this Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants