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

[8.7] [ResponseOps] Update flapping logic order to determine whether an alert is flapping after it's returned for notification (#151148) #152507

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

kibanamachine
Copy link
Contributor

…rt is flapping after it's returned for notification (elastic#151148)

Resolves elastic#151135

## Summary

Moved the logic around to check flapping after an alert is already
returned for notification. I also updated the event log test cases to
match examples in the rfc.

### 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
The new test cases capture this example but if you want to test it
locally:
- Create a connector and make sure to save the connector id
```
curl -X POST -u {username}:{password} "http://localhost:5601/api/actions/connector" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{
  "connector_type_id": ".server-log",
  "name": "server log",
  "config": {},
  "secrets": {}
}'
```
- Create the rule and let it run
```
curl -X POST -u {username}:{password} "http://localhost:5601/api/alerting/rule/" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{
  "rule_type_id": "example.pattern",
  "name": "pattern",
  "schedule": {
    "interval": "5s"
  },
  "actions": [
    { "group": "default", "id": {connector id}, "params": { "message": "{{alert.id}} active on run {{context.runs}} step {{context.patternIndex}} flapping {{alert.flapping}}"}},
    { "group": "recovered", "id": {connector id}, "params": { "message": "{{alert.id}} recovered on run flapping {{alert.flapping}}"}}
  ],
  "consumer": "alerts",
  "tags": [],
  "notify_when": "onActionGroupChange",
  "params": {
    "patterns": {
      "instA": " a - - a - a - a - a - - - - - - - - "
    }
  }
}'

```
- Verify that you see the following, we want to make sure that aren't
missing any notifications

![image](https://user-images.githubusercontent.com/109488926/221615405-48061d10-4b80-4b98-812a-6951da4178da.png)

(cherry picked from commit 5187a6f)
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

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

cc @doakalexi

@kibanamachine kibanamachine merged commit 99c6baf into elastic:8.7 Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants