elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.65k stars 8.23k forks source link

[Defend Workflows]Agent count on the `Save and deploy changes` Pop-up is not matching with the Total agents Count on the policy details page #194919

Open sukhwindersingh-qasource opened 1 month ago

sukhwindersingh-qasource commented 1 month ago

Describe the bug:

Build Details:

VERSION: 8.16.0 - Snapshot BUILD: 78786 COMMIT: 3d2d667e3d7a56d577f590581a19b599ab332b7b

Login Credentials

Preconditions

Steps to Reproduce

Actual result

Expected Result

Additional Information

Screen-cast

https://github.com/user-attachments/assets/f0164d13-de86-4665-84e3-a28e5ee9c962

Logs

elasticmachine commented 1 month ago

Pinging @elastic/security-solution (Team: SecuritySolution)

elasticmachine commented 1 month ago

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

sukhwindersingh-qasource commented 1 month ago

@muskangulati-qasource Please review this

dasansol92 commented 1 month ago

hey @sukhwindersingh-qasource which is the real total agents count for that policy? Is it the one on the modal or the one on the agents count in policy details page (top right corner)? We did some fixes here for the agents count in policy details page: https://github.com/elastic/kibana/pull/194294 But not sure if these were included in that testing. @szwarckonrad any thoughts?

muskangulati-qasource commented 1 month ago

Secondary review for this ticket is Done!

sukhwindersingh-qasource commented 1 month ago

Hi @dasansol92 ,

The fix is working as expected. The actual agent count is 02 (for Healthy, Unhealthy, and Offline), but the pop-up is showing 04 agents. It is also counting the agents that have been unenrolled from the Fleet tab.

Screenshot :

Image

Please Let us Know if anything else is required from our end.

Thanks!

dasansol92 commented 1 month ago

Thanks @sukhwindersingh-qasource , is this happening in previous versions of the stack? Want to make sure when this started to show unenrolled agents. Thanks!

sukhwindersingh-qasource commented 1 month ago

Hi @dasansol92 ,

We re-validated this on the two previous released Builds 8.15.2 & 8.14.0 and observed that it is happening on both of the builds.

Please find below the testing details

Build Details:

VERSION: 8.15.2 BUILD: 76625 COMMIT: 5a522bfe14bc6d06c20bc337477fd53f7c538973

VERSION: 8.14.0 BUILD: 73988 COMMIT: 3bc2979d1d65982aee7d13ebd65434c3470dc808

Screen-cast:

8.15.2

https://github.com/user-attachments/assets/feb7f96c-898d-49f4-a6b1-09377cd45f43

8.14.0

https://github.com/user-attachments/assets/86270940-5054-4c8a-a50a-f4e732664425

Please Let us know if anything else is required from our end.

Thanks!

szwarckonrad commented 1 month ago

@dasansol92 After a quick look, it seems this part is causing the issue: https://github.com/elastic/kibana/blob/a9ab9ea103aad66f09b5073a30bba46cbba8df79/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_layout/policy_settings_layout.tsx#L173. It hasn’t been updated in a while, and I believe we could reuse the fetching mechanism I introduced in the PR you mentioned, instead of building a kuery https://github.com/elastic/kibana/blob/a9ab9ea103aad66f09b5073a30bba46cbba8df79/x-pack/plugins/security_solution/public/management/hooks/policy/use_fetch_endpoint_policy_agent_summary.ts#L17-L43

In the top bar we are using these results

https://github.com/elastic/kibana/blob/b35328f2b26e46c60bffc633b1d64fd894c2292d/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx#L61-L68