-
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] Agent tags not loading with default status filters, bulk update tags not working #148233
Comments
Pinging @elastic/fleet (Team:Fleet) |
I think the root cause is that we have several places where the status filters can be used in the code, and those places have to be updated to use the runtime fields: https://github.com/elastic/kibana/pull/147552/files#diff-f7377ed9ad56eaa8ea188b64e957e771ccc7a7652fd1eaf44251c25b930f8448 It is easy to fix the As a quick fix we could remove the status filters from update tags (at least when the filters are set to the default values) to unblock the feature. I reviewed the code where the agents index is queried with filters, and none of the other places have missing runtime fields. |
This is a pretty big caveat to runtime fields usage. Wouldn't this also apply to bulk upgrades where we update all the agent documents' I wonder if we could find a way to re-use the runtime script from the mappings in the query itself. Not sure if it's supported in the ways we would need, but we could explore using a stored script that is called from the runtime field and the update_by_query calls. |
## Summary Partial fix for #148233 Added missing runtime fields to tags query. This fixes Tags filter on Agent List UI when status filters are present. <img width="1060" alt="image" src="https://user-images.githubusercontent.com/90178898/210068647-347ed2a9-9339-47f3-b84a-b916afbf17d1.png"> Added a quick fix to remove default status filter from bulk update tags. This will not work correctly if there are inactive/unenrolled agents. Update tags with non-default status filters doesn't work either. EDIT: added back status filters on real fields from history, and using them in update tags. The missing piece is to tweak the unenrolled/inactive filters to their latest logic. This should fix update tags on all status filters, though we have the status logic in two places. Ideally the status field should become a real field. <img width="1039" alt="image" src="https://user-images.githubusercontent.com/90178898/210070213-f466b381-59a8-454c-81be-699989becf02.png"> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
No, upgrade is not using
I thought about this, though update tags already uses a script with @hop-dev suggested another solution here to do a search first with runtime fields, and then do the |
## Summary Closes #148233 Fixing issue of bulk update tags not working with the new agent status runtime field. Refactored update tags to use batching again, resolving 10k agent ids at a time and `updateByQuery` on batches. Works locally with dummy agents, has to be tested on cloud with horde to simulate conflicts. ### 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 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Kibana version: 8.7.0
Describe the bug: With the default filters (Healthy, Unhealthy, Updating, Offline) Agent Tags are not loading, and bulk update tags doesn't update any agents. Something might be wrong with the default filters.
Steps to reproduce:
Expected behavior:
Tags filters should be loaded with default status filters, bulk update tags should work.
Screenshots (if relevant):
![image](https://user-images.githubusercontent.com/90178898/210065927-009274e8-41c0-4a17-8078-92e9a237a1bb.png)
![image](https://user-images.githubusercontent.com/90178898/210065947-33966bd5-9d2b-4324-9f49-7b155450355e.png)
Any additional context:
Caused by #147552 where the status field has changed.
Tags request:
http://localhost:5601/julia/api/fleet/agents/tags?kuery=status%3Aonline%20or%20(status%3Aerror%20or%20status%3Adegraded)%20or%20(status%3Aupdating%20or%20status%3Aunenrolling%20or%20status%3Aenrolling)%20or%20status%3Aoffline&showInactive=false
Bulk update tags request:
The text was updated successfully, but these errors were encountered: