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

[Response Ops][Actions] Fixing bug where context variables are not passed in when alerts as data doc is available in action params #175682

Merged
merged 2 commits into from Jan 26, 2024

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Jan 26, 2024

Resolves #175624

Summary

Fixes a bug where context and state variables were not passed to the action params for interpolation if the alert-as-data document is available.

To Verify

  • Create a rule and add an action that fires For each alert - on check intervals
  • Add a condition to the action, either a KQL query or a time range
  • Make sure the action message references some context variables (default ES query or Index Threshold rule messages should include context variables)
  • Save the rule and make sure the action fired correctly includes the referenced context variables.

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 26, 2024

/ci

@ymao1 ymao1 self-assigned this Jan 26, 2024
@ymao1 ymao1 changed the title Passing in context variables even when alerts as data doc is available [Response Ops][Actions] Fixing bug where context variables are not passed in when alerts as data doc is available in action params Jan 26, 2024
@ymao1 ymao1 added bug Fixes for quality problems that affect the customer experience release_note:fix v8.12.1 v8.13.0 Feature:Actions Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Jan 26, 2024
@ymao1 ymao1 marked this pull request as ready for review January 26, 2024 16:45
@ymao1 ymao1 requested a review from a team as a code owner January 26, 2024 16:45
@elasticmachine
Copy link
Contributor

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

Copy link
Member

@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 - works as expected

@ymao1
Copy link
Contributor Author

ymao1 commented Jan 26, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

cc @ymao1

@ymao1 ymao1 merged commit 8a6ee8a into elastic:main Jan 26, 2024
34 checks passed
@ymao1 ymao1 deleted the alerting/missing-context branch January 26, 2024 21:36
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 26, 2024
…ssed in when alerts as data doc is available in action params (elastic#175682)

Resolves elastic#175624

## Summary

Fixes a bug where context and state variables were not passed to the
action params for interpolation if the alert-as-data document is
available.

## To Verify
* Create a rule and add an action that fires `For each alert - on check
intervals`
* Add a condition to the action, either a KQL query or a time range
* Make sure the action message references some context variables
(default ES query or Index Threshold rule messages should include
context variables)
* Save the rule and make sure the action fired correctly includes the
referenced context variables.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 8a6ee8a)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

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 Jan 27, 2024
… not passed in when alerts as data doc is available in action params (#175682) (#175737)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Response Ops][Actions] Fixing bug where context variables are not
passed in when alerts as data doc is available in action params
(#175682)](#175682)

<!--- 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-01-26T21:36:35Z","message":"[Response
Ops][Actions] Fixing bug where context variables are not passed in when
alerts as data doc is available in action params (#175682)\n\nResolves
#175624
Summary\r\n\r\nFixes a bug where context and state variables were not
passed to the\r\naction params for interpolation if the alert-as-data
document is\r\navailable.\r\n\r\n## To Verify\r\n* Create a rule and add
an action that fires `For each alert - on check\r\nintervals`\r\n* Add a
condition to the action, either a KQL query or a time range\r\n* Make
sure the action message references some context variables\r\n(default ES
query or Index Threshold rule messages should include\r\ncontext
variables)\r\n* Save the rule and make sure the action fired correctly
includes the\r\nreferenced context variables.\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8a6ee8a4c0df7f687c57748c1e9f1155167b00aa","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Feature:Actions","Team:ResponseOps","v8.12.1","v8.13.0"],"title":"[Response
Ops][Actions] Fixing bug where context variables are not passed in when
alerts as data doc is available in action
params","number":175682,"url":"#175682
Ops][Actions] Fixing bug where context variables are not passed in when
alerts as data doc is available in action params (#175682)\n\nResolves
#175624
Summary\r\n\r\nFixes a bug where context and state variables were not
passed to the\r\naction params for interpolation if the alert-as-data
document is\r\navailable.\r\n\r\n## To Verify\r\n* Create a rule and add
an action that fires `For each alert - on check\r\nintervals`\r\n* Add a
condition to the action, either a KQL query or a time range\r\n* Make
sure the action message references some context variables\r\n(default ES
query or Index Threshold rule messages should include\r\ncontext
variables)\r\n* Save the rule and make sure the action fired correctly
includes the\r\nreferenced context variables.\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8a6ee8a4c0df7f687c57748c1e9f1155167b00aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"#175682
Ops][Actions] Fixing bug where context variables are not passed in when
alerts as data doc is available in action params (#175682)\n\nResolves
#175624
Summary\r\n\r\nFixes a bug where context and state variables were not
passed to the\r\naction params for interpolation if the alert-as-data
document is\r\navailable.\r\n\r\n## To Verify\r\n* Create a rule and add
an action that fires `For each alert - on check\r\nintervals`\r\n* Add a
condition to the action, either a KQL query or a time range\r\n* Make
sure the action message references some context variables\r\n(default ES
query or Index Threshold rule messages should include\r\ncontext
variables)\r\n* Save the rule and make sure the action fired correctly
includes the\r\nreferenced context variables.\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"8a6ee8a4c0df7f687c57748c1e9f1155167b00aa"}}]}]
BACKPORT-->

Co-authored-by: Ying Mao <ying.mao@elastic.co>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…ssed in when alerts as data doc is available in action params (elastic#175682)

Resolves elastic#175624

## Summary

Fixes a bug where context and state variables were not passed to the
action params for interpolation if the alert-as-data document is
available.

## To Verify
* Create a rule and add an action that fires `For each alert - on check
intervals`
* Add a condition to the action, either a KQL query or a time range
* Make sure the action message references some context variables
(default ES query or Index Threshold rule messages should include
context variables)
* Save the rule and make sure the action fired correctly includes the
referenced context variables.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…ssed in when alerts as data doc is available in action params (elastic#175682)

Resolves elastic#175624

## Summary

Fixes a bug where context and state variables were not passed to the
action params for interpolation if the alert-as-data document is
available.

## To Verify
* Create a rule and add an action that fires `For each alert - on check
intervals`
* Add a condition to the action, either a KQL query or a time range
* Make sure the action message references some context variables
(default ES query or Index Threshold rule messages should include
context variables)
* Save the rule and make sure the action fired correctly includes the
referenced context variables.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
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:Actions release_note:fix Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] context in actions is missing when an alert filter is applied
5 participants