-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Fix exception in agents list when units field is missing from components #161360
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Pinging @elastic/fleet (Team:Fleet) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing that one LGTM 🚀
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @criamico |
… components (elastic#161360) ## Summary Fix an issue found in 8.8.2 with `8.7.1` inactive agents. The agents list endpoint was returning an exception, after some investigation it was found that the issue was a missing `units` property in the components field of the agents. This was a very specific edge case and in fact I could not reproduce locally, but it still happened in a minority of cases after upgrading to 8.8.2. The agents in this case have components that look like this: ``` "components": [ { "id": "http/metrics-monitoring", "type": "http/metrics", "message": "Starting", "status": "STARTING" }, ... ] ``` But this property was typed as mandatory so we didn't check for undefined. The actual bug was tracked here: https://github.com/elastic/kibana/blob/2070836060046aaec0ff28ddfcce91356cf98930/x-pack/plugins/fleet/server/services/agents/helpers.ts#L50 and was causing this error: https://github.com/elastic/kibana/assets/16084106/607b5aed-155b-4509-896a-ada7507e4dc3 I also updated the type to have `units` as optional and fixed a couple of other places where this could cause issues. ### Checklist - [ ] [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 --------- Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit 36e7d60)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…g from components (#161360) (#161442) # Backport This will backport the following commits from `main` to `8.9`: - [[Fleet] Fix exception in agents list when units field is missing from components (#161360)](#161360) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Cristina Amico","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-07-07T10:13:37Z","message":"[Fleet] Fix exception in agents list when units field is missing from components (#161360)\n\n## Summary\r\nFix an issue found in 8.8.2 with `8.7.1` inactive agents. The agents\r\nlist endpoint was returning an exception, after some investigation it\r\nwas found that the issue was a missing `units` property in the\r\ncomponents field of the agents.\r\n\r\nThis was a very specific edge case and in fact I could not reproduce\r\nlocally, but it still happened in a minority of cases after upgrading to\r\n8.8.2.\r\n\r\nThe agents in this case have components that look like this:\r\n```\r\n \"components\": [\r\n {\r\n \"id\": \"http/metrics-monitoring\",\r\n \"type\": \"http/metrics\",\r\n \"message\": \"Starting\",\r\n \"status\": \"STARTING\"\r\n },\r\n ...\r\n]\r\n```\r\nBut this property was typed as mandatory so we didn't check for\r\nundefined. The actual bug was tracked here:\r\n\r\nhttps://github.com/elastic/kibana/blob/2070836060046aaec0ff28ddfcce91356cf98930/x-pack/plugins/fleet/server/services/agents/helpers.ts#L50\r\n\r\nand was causing this error:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/16084106/607b5aed-155b-4509-896a-ada7507e4dc3\r\n\r\nI also updated the type to have `units` as optional and fixed a couple\r\nof other places where this could cause issues.\r\n\r\n### Checklist\r\n- [ ] [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\r\nCo-authored-by: Kibana Machine <[email protected]>","sha":"36e7d600ce9cbc39b7a0e55165a65a4634b30b6c","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.9.0","v8.10.0","v8.8.3"],"number":161360,"url":"https://github.com/elastic/kibana/pull/161360","mergeCommit":{"message":"[Fleet] Fix exception in agents list when units field is missing from components (#161360)\n\n## Summary\r\nFix an issue found in 8.8.2 with `8.7.1` inactive agents. The agents\r\nlist endpoint was returning an exception, after some investigation it\r\nwas found that the issue was a missing `units` property in the\r\ncomponents field of the agents.\r\n\r\nThis was a very specific edge case and in fact I could not reproduce\r\nlocally, but it still happened in a minority of cases after upgrading to\r\n8.8.2.\r\n\r\nThe agents in this case have components that look like this:\r\n```\r\n \"components\": [\r\n {\r\n \"id\": \"http/metrics-monitoring\",\r\n \"type\": \"http/metrics\",\r\n \"message\": \"Starting\",\r\n \"status\": \"STARTING\"\r\n },\r\n ...\r\n]\r\n```\r\nBut this property was typed as mandatory so we didn't check for\r\nundefined. The actual bug was tracked here:\r\n\r\nhttps://github.com/elastic/kibana/blob/2070836060046aaec0ff28ddfcce91356cf98930/x-pack/plugins/fleet/server/services/agents/helpers.ts#L50\r\n\r\nand was causing this error:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/16084106/607b5aed-155b-4509-896a-ada7507e4dc3\r\n\r\nI also updated the type to have `units` as optional and fixed a couple\r\nof other places where this could cause issues.\r\n\r\n### Checklist\r\n- [ ] [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\r\nCo-authored-by: Kibana Machine <[email protected]>","sha":"36e7d600ce9cbc39b7a0e55165a65a4634b30b6c"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.8"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161360","number":161360,"mergeCommit":{"message":"[Fleet] Fix exception in agents list when units field is missing from components (#161360)\n\n## Summary\r\nFix an issue found in 8.8.2 with `8.7.1` inactive agents. The agents\r\nlist endpoint was returning an exception, after some investigation it\r\nwas found that the issue was a missing `units` property in the\r\ncomponents field of the agents.\r\n\r\nThis was a very specific edge case and in fact I could not reproduce\r\nlocally, but it still happened in a minority of cases after upgrading to\r\n8.8.2.\r\n\r\nThe agents in this case have components that look like this:\r\n```\r\n \"components\": [\r\n {\r\n \"id\": \"http/metrics-monitoring\",\r\n \"type\": \"http/metrics\",\r\n \"message\": \"Starting\",\r\n \"status\": \"STARTING\"\r\n },\r\n ...\r\n]\r\n```\r\nBut this property was typed as mandatory so we didn't check for\r\nundefined. The actual bug was tracked here:\r\n\r\nhttps://github.com/elastic/kibana/blob/2070836060046aaec0ff28ddfcce91356cf98930/x-pack/plugins/fleet/server/services/agents/helpers.ts#L50\r\n\r\nand was causing this error:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/16084106/607b5aed-155b-4509-896a-ada7507e4dc3\r\n\r\nI also updated the type to have `units` as optional and fixed a couple\r\nof other places where this could cause issues.\r\n\r\n### Checklist\r\n- [ ] [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\r\nCo-authored-by: Kibana Machine <[email protected]>","sha":"36e7d600ce9cbc39b7a0e55165a65a4634b30b6c"}},{"branch":"8.8","label":"v8.8.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Cristina Amico <[email protected]>
Summary
Fix an issue found in 8.8.2 with
8.7.1
inactive agents. The agents list endpoint was returning an exception, after some investigation it was found that the issue was a missingunits
property in the components field of the agents.This was a very specific edge case and in fact I could not reproduce locally, but it still happened in a minority of cases after upgrading to 8.8.2.
The agents in this case have components that look like this:
But this property was typed as mandatory so we didn't check for undefined. The actual bug was tracked here:
kibana/x-pack/plugins/fleet/server/services/agents/helpers.ts
Line 50 in 2070836
and was causing this error:
20230706-0815-53.7265166.mp4
I also updated the type to have
units
as optional and fixed a couple of other places where this could cause issues.Checklist