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

Agents section performance improvements #4363

Merged
merged 9 commits into from
Sep 8, 2022

Conversation

asteriscos
Copy link
Member

@asteriscos asteriscos commented Jul 29, 2022

Description

This PR optimizes the number of requests Agents Overview makes. It also fixes some unnecessary use of await of requests, this way requests don't need to finish to start a new one and the API can process them at the same time. It improves the view performance by launching some requests to the API in parallel, instead of sequentially.

Results

As a result of these changes, the section has improved significantly the init loading time.

Before the changes:
image

After the changes:
image

Closes #3623

Loading experience

This PR includes a change to make each card and KPI have independent loading indicator to make information available as soon as possible, instead of waiting every dashboard request response.

Peek 2022-08-01 19-17

There's a known issue with the Evolution loading indicator: there's a shared loading state which makes the Agents Evolution loading icon flicker.

@asteriscos asteriscos changed the title Agents sections performance improvements Agents section performance improvements Jul 29, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2022

Jest Test Coverage % values
Statements 6.69% ( 2431 / 36352 )
Branches 2.68% ( 754 / 28133 )
Functions 4.48% ( 398 / 8882 )
Lines 6.77% ( 2352 / 34767 )

@asteriscos asteriscos marked this pull request as ready for review August 2, 2022 13:53
@asteriscos asteriscos self-assigned this Aug 2, 2022
@AlexRuiz7 AlexRuiz7 linked an issue Aug 8, 2022 that may be closed by this pull request
2 tasks
@asteriscos asteriscos changed the base branch from 4.3-7.10 to 4.4-7.10 September 6, 2022 08:50
@Mayons95 Mayons95 self-requested a review September 6, 2022 12:55
@Mayons95
Copy link
Contributor

Mayons95 commented Sep 7, 2022

TR: ✔️

Screencast.from.07-09-22.10.50.14.webm

Comment: We detected a wrong label on synced agent percentage.
Screenshot from 2022-09-07 10-51-50
C.C @asteriscos

@asteriscos
Copy link
Member Author

TR: heavy_check_mark

Screencast.from.07-09-22.10.50.14.webm
Comment: We detected a wrong label on synced agent percentage. Screenshot from 2022-09-07 10-51-50 C.C @asteriscos

Good catch!
I added the new synced agents initial value as well in this commit.
Screenshot from 2022-09-07 16-54-29

@Mayons95
Copy link
Contributor

Mayons95 commented Sep 7, 2022

Commit Test OK!
I attached the video here
Screencast from 07-09-22 12:07:48.webm
C.C @asteriscos @AlexRuiz7

Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

perfomance.mp4

@asteriscos asteriscos merged commit 4f710c1 into 4.4-7.10 Sep 8, 2022
@asteriscos asteriscos deleted the enhance/improve-performance-of-agents-section branch September 8, 2022 12:42
@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2022

The backport to 4.4-7.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.4-7.16 4.4-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.4-7.16
# Create a new branch
git switch --create backport-4363-to-4.4-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4f710c1c1aefa1395a24c82e8a5d1ff673a47ee6
# Push it to GitHub
git push --set-upstream origin backport-4363-to-4.4-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-7.16

Then, create a pull request where the base branch is 4.4-7.16 and the compare/head branch is backport-4363-to-4.4-7.16.

github-actions bot pushed a commit that referenced this pull request Sep 8, 2022
* Requests improvements

* Fix Agent wizard close state

* Independent loading cards

* Updated wazuh version

* Added changelog

* Added agentsSynced initial value

* Added flex-wrap to KPIs

(cherry picked from commit 4f710c1)
AlexRuiz7 added a commit that referenced this pull request Sep 8, 2022
Agents section performance improvements (#4363)

* Requests improvements

* Fix Agent wizard close state

* Independent loading cards

* Updated wazuh version

* Added changelog

* Added agentsSynced initial value

* Added flex-wrap to KPIs

(cherry picked from commit 4f710c1)

Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
asteriscos added a commit that referenced this pull request Sep 8, 2022
* Requests improvements

* Fix Agent wizard close state

* Independent loading cards

* Updated wazuh version

* Added changelog

* Added agentsSynced initial value

* Added flex-wrap to KPIs

(cherry picked from commit 4f710c1)
asteriscos added a commit that referenced this pull request Sep 9, 2022
* Requests improvements

* Fix Agent wizard close state

* Independent loading cards

* Updated wazuh version

* Added changelog

* Added agentsSynced initial value

* Added flex-wrap to KPIs

(cherry picked from commit 4f710c1)
asteriscos added a commit that referenced this pull request Sep 9, 2022
* Agents section performance improvements (#4363)

* Requests improvements

* Fix Agent wizard close state

* Independent loading cards

* Updated wazuh version

* Added changelog

* Added agentsSynced initial value

* Added flex-wrap to KPIs

(cherry picked from commit 4f710c1)

* Update CHANGELOG.md
@asteriscos asteriscos mentioned this pull request Sep 9, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time-consuming Agents section
3 participants