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.9] [Fleet] Fix exception in agents list when units field is missing from components (#161360) #161442

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.9:

Questions ?

Please refer to the Backport tool documentation

… 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)
@kibanamachine kibanamachine enabled auto-merge (squash) July 7, 2023 10:19
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jul 7, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
fleet 976.9KB 977.0KB +26.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 415 419 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 496 500 +4
total +6

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

cc @criamico

@kibanamachine kibanamachine merged commit 3c59c4d into elastic:8.9 Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants