Skip to content

[Response Ops][Alerting] Do not copy latest rule configuration into recovered alerts.#195946

Merged
ymao1 merged 2 commits intoelastic:mainfrom
ymao1:alerting/#181828
Oct 24, 2024
Merged

[Response Ops][Alerting] Do not copy latest rule configuration into recovered alerts.#195946
ymao1 merged 2 commits intoelastic:mainfrom
ymao1:alerting/#181828

Conversation

@ymao1
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 commented Oct 11, 2024

Resolves #181828

Summary

Do not update recovered alerts with the current rule configuration. This allows recovered alerts to preserver the configuration of the rule at the time the alert was last active. This makes sense because it is possible that a change to the rule configuration caused any existing alerts to recover so it is a confusing user experience to see a recovered alert include the latest rule configuration.

To Verify

  1. Create a custom threshold rule with no group by field and let it run to create an alert
  2. Edit the rule to add a group by field and let it run. The first alert should recover and grouped alerts should be created.
  3. Navigate to the alert details for the recovered alert and see that the details view metadata tab correctly shows the ungrouped rule configuration, not the grouped rule configuration.

@ymao1 ymao1 changed the title dont update rule config in recovered alerts [Response Ops][Alerting] Do not copy latest rule configuration into recovered alerts. Oct 23, 2024
@ymao1 ymao1 self-assigned this Oct 23, 2024
@ymao1 ymao1 added Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.0.0 backport:prev-minor v8.17.0 labels Oct 23, 2024
@ymao1 ymao1 marked this pull request as ready for review October 23, 2024 21:47
@ymao1 ymao1 requested a review from a team as a code owner October 23, 2024 21:47
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Member

@maryam-saeidi maryam-saeidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked as expected, thanks!

Copy link
Copy Markdown
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but left a comment about the change from flattened to non-flattened alert data.

timestamp: '2023-03-29T12:27:28.159Z',
})
).toEqual({
...alertRule,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alertRule is an object with "flattened" properties:

export const alertRule: AlertRule = {
[ALERT_RULE_CATEGORY]: rule.category,
[ALERT_RULE_CONSUMER]: rule.consumer,
[ALERT_RULE_EXECUTION_UUID]: rule.execution.uuid,
[ALERT_RULE_NAME]: rule.name,
[ALERT_RULE_PARAMETERS]: rule.parameters,
[ALERT_RULE_PRODUCER]: rule.producer,
[ALERT_RULE_REVISION]: rule.revision,
[ALERT_RULE_TYPE_ID]: rule.rule_type_id,
[ALERT_RULE_TAGS]: rule.tags,
[ALERT_RULE_UUID]: rule.uuid,
[SPACE_IDS]: ['default'],
};

But is being replaced with non-flattened properties, below.

I'm thinking this is ok because we always end up flattening, in the end?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, essentially!

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 24, 2024

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @ymao1

@ymao1 ymao1 merged commit df270ca into elastic:main Oct 24, 2024
@ymao1 ymao1 deleted the alerting/#181828 branch October 24, 2024 22:12
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11508266979

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 24, 2024
…into recovered alerts. (#195946) (#197741)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Response Ops][Alerting] Do not copy latest rule configuration into
recovered alerts.
(#195946)](#195946)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2024-10-24T22:12:51Z","message":"[Response
Ops][Alerting] Do not copy latest rule configuration into recovered
alerts.
(#195946)","sha":"df270ca6cdefde229ea32f1e9668710b03457a57","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.17.0"],"title":"[Response
Ops][Alerting] Do not copy latest rule configuration into recovered
alerts.","number":195946,"url":"https://github.com/elastic/kibana/pull/195946","mergeCommit":{"message":"[Response
Ops][Alerting] Do not copy latest rule configuration into recovered
alerts.
(#195946)","sha":"df270ca6cdefde229ea32f1e9668710b03457a57"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195946","number":195946,"mergeCommit":{"message":"[Response
Ops][Alerting] Do not copy latest rule configuration into recovered
alerts.
(#195946)","sha":"df270ca6cdefde229ea32f1e9668710b03457a57"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ying Mao <ying.mao@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.17.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Custom threshold][Alert details page] Bug in alert details page main and history charts when rule is edited

5 participants