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] The count of consecutive active alerts should be available on the alert #177522

Merged
merged 13 commits into from
Mar 12, 2024

Conversation

doakalexi
Copy link
Contributor

@doakalexi doakalexi commented Feb 21, 2024

Resolves #175998

Summary

Follow on work from the alert creation delay feature. This PR adds consecutive_matches, which is the count of active alerts that is used to determine the alert delay, to the aad doc and to the action variables.

Checklist

To verify

  • Create a new rule with an alert delay
  • Add the new alert.consecutiveMatches action variable to the action message. Verify that when the alert fires the action variable is populated in the message.
  • To verify that the alert docs are as expected, go to Dev Tools and run the following GET .internal.alerts-*/_search
  • Go back to the rule alerts table, and add the kibana.alert.consecutive_matches field to the table. Verify that it is populated and looks as expected.

@doakalexi
Copy link
Contributor Author

ci/

@doakalexi
Copy link
Contributor Author

/ci

@doakalexi
Copy link
Contributor Author

/ci

@doakalexi
Copy link
Contributor Author

/ci

@doakalexi
Copy link
Contributor Author

/ci

@doakalexi
Copy link
Contributor Author

/ci

@doakalexi doakalexi changed the title Adding active count to aad and action variables ResponseOps] The count of consecutive active alerts should be available on the alert Feb 23, 2024
@doakalexi doakalexi added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) release_note:skip Skip the PR/issue when compiling release notes v8.13.0 v8.14.0 labels Feb 23, 2024
@doakalexi
Copy link
Contributor Author

/ci

@doakalexi doakalexi marked this pull request as ready for review March 6, 2024 13:59
@doakalexi doakalexi requested review from a team as code owners March 6, 2024 13:59
@elasticmachine
Copy link
Contributor

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

@semd
Copy link
Contributor

semd commented Mar 6, 2024

@doakalexi we had a forgotten dependency with alerts in the data-stream-adapter package, I removed that here. Could you please pull the changes, then you'll be able to remove security-threat-hunting-explore from reviewers. Thanks.

@doakalexi doakalexi removed the request for review from a team March 6, 2024 17:00
@doakalexi doakalexi changed the title ResponseOps] The count of consecutive active alerts should be available on the alert [ResponseOps] The count of consecutive active alerts should be available on the alert Mar 6, 2024
Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Verified that this works as expected. Tested with ES query rule, custom threshold rule (that uses lifecycle executor) and security rule. Left one comment about the new field in the technical field names. I don't think the field should be showing up in the generated security schema, just the framework alert_schema

packages/kbn-rule-data-utils/src/technical_field_names.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Verified works as expected

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/rule-data-utils 119 120 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.2MB 3.2MB +41.0B
infra 1.4MB 1.4MB +41.0B
observability 894.7KB 894.8KB +41.0B
securitySolution 12.8MB 12.8MB +104.0B
triggersActionsUi 1.6MB 1.6MB +41.0B
total +268.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
apm 34.6KB 34.7KB +63.0B
infra 102.5KB 102.6KB +63.0B
observability 108.8KB 108.9KB +63.0B
triggersActionsUi 108.3KB 108.6KB +339.0B
total +528.0B
Unknown metric groups

API count

id before after diff
@kbn/rule-data-utils 122 123 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@doakalexi doakalexi merged commit 3c2956c into elastic:main Mar 12, 2024
35 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 12, 2024
…ble on the alert (elastic#177522)

Resolves elastic#175998

## Summary
Follow on work from the alert creation delay feature. This PR adds
consecutive_matches, which is the count of active alerts that is used to
determine the alert delay, to the aad doc and to the action variables.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### To verify

- Create a new rule with an alert delay
- Add the new `alert.consecutiveMatches` action variable to the action
message. Verify that when the alert fires the action variable is
populated in the message.
- To verify that the alert docs are as expected, go to [Dev
Tools](http://localhost:5601/app/dev_tools#/console) and run the
following `GET .internal.alerts-*/_search`
- Go back to the rule alerts table, and add the
`kibana.alert.consecutive_matches` field to the table. Verify that it is
populated and looks as expected.

(cherry picked from commit 3c2956c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.13

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 Mar 12, 2024
… available on the alert (#177522) (#178541)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[ResponseOps] The count of consecutive active alerts should be
available on the alert
(#177522)](#177522)

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

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

<!--BACKPORT [{"author":{"name":"Alexi
Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-03-12T16:36:19Z","message":"[ResponseOps]
The count of consecutive active alerts should be available on the alert
(#177522)\n\nResolves
#175998
Summary\r\nFollow on work from the alert creation delay feature. This PR
adds\r\nconsecutive_matches, which is the count of active alerts that is
used to\r\ndetermine the alert delay, to the aad doc and to the action
variables.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### To
verify\r\n\r\n- Create a new rule with an alert delay\r\n- Add the new
`alert.consecutiveMatches` action variable to the action\r\nmessage.
Verify that when the alert fires the action variable is\r\npopulated in
the message.\r\n- To verify that the alert docs are as expected, go to
[Dev\r\nTools](http://localhost:5601/app/dev_tools#/console) and run
the\r\nfollowing `GET .internal.alerts-*/_search`\r\n- Go back to the
rule alerts table, and add the\r\n`kibana.alert.consecutive_matches`
field to the table. Verify that it is\r\npopulated and looks as
expected.","sha":"3c2956cd0cd4b97dd1c6e6673c5954c69337b790","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v8.13.0","v8.14.0"],"title":"[ResponseOps]
The count of consecutive active alerts should be available on the
alert","number":177522,"url":"#177522
The count of consecutive active alerts should be available on the alert
(#177522)\n\nResolves
#175998
Summary\r\nFollow on work from the alert creation delay feature. This PR
adds\r\nconsecutive_matches, which is the count of active alerts that is
used to\r\ndetermine the alert delay, to the aad doc and to the action
variables.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### To
verify\r\n\r\n- Create a new rule with an alert delay\r\n- Add the new
`alert.consecutiveMatches` action variable to the action\r\nmessage.
Verify that when the alert fires the action variable is\r\npopulated in
the message.\r\n- To verify that the alert docs are as expected, go to
[Dev\r\nTools](http://localhost:5601/app/dev_tools#/console) and run
the\r\nfollowing `GET .internal.alerts-*/_search`\r\n- Go back to the
rule alerts table, and add the\r\n`kibana.alert.consecutive_matches`
field to the table. Verify that it is\r\npopulated and looks as
expected.","sha":"3c2956cd0cd4b97dd1c6e6673c5954c69337b790"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"#177522
The count of consecutive active alerts should be available on the alert
(#177522)\n\nResolves
#175998
Summary\r\nFollow on work from the alert creation delay feature. This PR
adds\r\nconsecutive_matches, which is the count of active alerts that is
used to\r\ndetermine the alert delay, to the aad doc and to the action
variables.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### To
verify\r\n\r\n- Create a new rule with an alert delay\r\n- Add the new
`alert.consecutiveMatches` action variable to the action\r\nmessage.
Verify that when the alert fires the action variable is\r\npopulated in
the message.\r\n- To verify that the alert docs are as expected, go to
[Dev\r\nTools](http://localhost:5601/app/dev_tools#/console) and run
the\r\nfollowing `GET .internal.alerts-*/_search`\r\n- Go back to the
rule alerts table, and add the\r\n`kibana.alert.consecutive_matches`
field to the table. Verify that it is\r\npopulated and looks as
expected.","sha":"3c2956cd0cd4b97dd1c6e6673c5954c69337b790"}}]}]
BACKPORT-->

---------

Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.13.0 v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ResponseOps] The count of consecutive active alerts should be available on the alert
6 participants