[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount')#221799
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
|
I put this back to draft because the new test is failing. I will take a look, sorry for the noise |
…:doakalexi/kibana into fix-undefined-alert-getting-active-count
…:doakalexi/kibana into fix-undefined-alert-getting-active-count
jbudz
left a comment
There was a problem hiding this comment.
.buildkite/ftr_platform_stateful_configs.yml LGTM
| '--xpack.alerting.invalidateApiKeysTask.removalDelay="1s"', | ||
| '--xpack.alerting.healthCheck.interval="1s"', | ||
| '--xpack.alerting.rules.minimumScheduleInterval.value="1s"', | ||
| '--xpack.alerting.rules.run.alerts.max=110', |
There was a problem hiding this comment.
this was set to > 100 to test the maintenance window top hits fix :)
There was a problem hiding this comment.
oh i see, you're configuring it now. all good
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
|
|
Starting backport for target branches: 8.19 https://github.com/elastic/kibana/actions/runs/15697981627 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
2 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… 'getActiveCount') (elastic#221799) Resolves elastic#208740 ## Summary This error message comes from the code where we drop the oldest recovered alerts from being tracked in the task state when there are more than 1000 (or alert limit) recovered alerts. The flapping refactor fixed this specific error, but I noticed that the alert documents weren't being updated before the alerts were dropped. This PR just moves this logic to the function that gets all the alerts to serialize in the task state, which happens after the alert documents are updated. ### Checklist Check the PR satisfies following conditions. - [ ] [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 1. Set `xpack.alerting.rules.run.alerts.max: 3` in kibana.yml 2. Start kibana and create a rule that will generate 3 alerts 3. Stop kibana and set the max alert limit to 2 in kibana.yml 4. Start kibana and update the conditions to recover the alerts. Because there are 3 alerts recovering and we can only track 2, one alert will be dropped from the task state. 5. Verify that all the alerts are marked as recovered. Let the rule run to verify that one of the alert's alert document is no longer updated. (cherry picked from commit fff8ae9)
…reading 'getActiveCount') (#221799) (#224881) # Backport This will backport the following commits from `main` to `8.19`: - [[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount') (#221799)](#221799) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alexi Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-17T04:13:36Z","message":"[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount') (#221799)\n\nResolves https://github.com/elastic/kibana/issues/208740\n\n## Summary\n\nThis error message comes from the code where we drop the oldest\nrecovered alerts from being tracked in the task state when there are\nmore than 1000 (or alert limit) recovered alerts. The flapping refactor\nfixed this specific error, but I noticed that the alert documents\nweren't being updated before the alerts were dropped. This PR just moves\nthis logic to the function that gets all the alerts to serialize in the\ntask state, which happens after the alert documents are updated.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n### To verify\n1. Set `xpack.alerting.rules.run.alerts.max: 3` in kibana.yml\n2. Start kibana and create a rule that will generate 3 alerts\n3. Stop kibana and set the max alert limit to 2 in kibana.yml\n4. Start kibana and update the conditions to recover the alerts. Because\nthere are 3 alerts recovering and we can only track 2, one alert will be\ndropped from the task state.\n5. Verify that all the alerts are marked as recovered. Let the rule run\nto verify that one of the alert's alert document is no longer updated.","sha":"fff8ae9bcce73d6ae7a76ec4a9fd75babc08c5bf","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","backport missing","backport:version","v9.1.0","v8.19.0"],"title":"[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount')","number":221799,"url":"https://github.com/elastic/kibana/pull/221799","mergeCommit":{"message":"[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount') (#221799)\n\nResolves https://github.com/elastic/kibana/issues/208740\n\n## Summary\n\nThis error message comes from the code where we drop the oldest\nrecovered alerts from being tracked in the task state when there are\nmore than 1000 (or alert limit) recovered alerts. The flapping refactor\nfixed this specific error, but I noticed that the alert documents\nweren't being updated before the alerts were dropped. This PR just moves\nthis logic to the function that gets all the alerts to serialize in the\ntask state, which happens after the alert documents are updated.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n### To verify\n1. Set `xpack.alerting.rules.run.alerts.max: 3` in kibana.yml\n2. Start kibana and create a rule that will generate 3 alerts\n3. Stop kibana and set the max alert limit to 2 in kibana.yml\n4. Start kibana and update the conditions to recover the alerts. Because\nthere are 3 alerts recovering and we can only track 2, one alert will be\ndropped from the task state.\n5. Verify that all the alerts are marked as recovered. Let the rule run\nto verify that one of the alert's alert document is no longer updated.","sha":"fff8ae9bcce73d6ae7a76ec4a9fd75babc08c5bf"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/221799","number":221799,"mergeCommit":{"message":"[Response Ops][Alerting] Cannot read properties of undefined (reading 'getActiveCount') (#221799)\n\nResolves https://github.com/elastic/kibana/issues/208740\n\n## Summary\n\nThis error message comes from the code where we drop the oldest\nrecovered alerts from being tracked in the task state when there are\nmore than 1000 (or alert limit) recovered alerts. The flapping refactor\nfixed this specific error, but I noticed that the alert documents\nweren't being updated before the alerts were dropped. This PR just moves\nthis logic to the function that gets all the alerts to serialize in the\ntask state, which happens after the alert documents are updated.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n### To verify\n1. Set `xpack.alerting.rules.run.alerts.max: 3` in kibana.yml\n2. Start kibana and create a rule that will generate 3 alerts\n3. Stop kibana and set the max alert limit to 2 in kibana.yml\n4. Start kibana and update the conditions to recover the alerts. Because\nthere are 3 alerts recovering and we can only track 2, one alert will be\ndropped from the task state.\n5. Verify that all the alerts are marked as recovered. Let the rule run\nto verify that one of the alert's alert document is no longer updated.","sha":"fff8ae9bcce73d6ae7a76ec4a9fd75babc08c5bf"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Resolves #208740
Summary
This error message comes from the code where we drop the oldest recovered alerts from being tracked in the task state when there are more than 1000 (or alert limit) recovered alerts. The flapping refactor fixed this specific error, but I noticed that the alert documents weren't being updated before the alerts were dropped. This PR just moves this logic to the function that gets all the alerts to serialize in the task state, which happens after the alert documents are updated.
Checklist
Check the PR satisfies following conditions.
To verify
xpack.alerting.rules.run.alerts.max: 3in kibana.yml