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

[Infrastructure UI][Rules] Specify recovery context for Log Threshold rule type #127080

Closed
simianhacker opened this issue Mar 7, 2022 · 2 comments
Labels
Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.3.0

Comments

@simianhacker
Copy link
Member

The alerting framework has recently merged a PR to provide rule executors with the ability to specify context for recovered alerts. Details are available in the PR and in the alerting README but essentially,

  1. Rule types should set doesSetRecoveryContext to true on the rule type. This allows context variables to appear in the action variable list in the UI for the recovered action group.
  2. Inside the rule executor, when the executor has finished scheduling actions for active alerts, the following code should be added:
// Call done() to gain access to recovery utils
// If `doesSetRecoveryContext` is set to `false`, getRecoveredAlerts() returns an empty list
const { getRecoveredAlerts } = alertsFactory.done();

for (const alert of getRecoveredAlerts()) {
	const alertId = alert.getId();
	alert.setContext({
		CONTEXT HERE!
	})
}

Note that currently, we expect the recovered context to match the existing typing for context variables on the rule.

Related to: #126279

@simianhacker simianhacker added Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services 8.3 candidate labels Mar 7, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@Kerry350
Copy link
Contributor

Kerry350 commented Mar 8, 2022

Apologies I hadn't seen you'd added issues for this as they weren't linked on the Meta issue. I'm going to link what you've added there. And I'm going to close this one in favour of #127123 purely because it's got implementation hints for that rule type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Logs UI Logs UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.3.0
Projects
None yet
Development

No branches or pull requests

4 participants