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

Move queue management to dispatcher #1095

Closed

Conversation

michel-laterman
Copy link
Contributor

@michel-laterman michel-laterman commented Sep 6, 2022

What does this PR do?

Move queue management actions to the dispatcher from the fleet-server in order to help with future work to add a retry mechanism. Add a PersistedQueue type which wrap the ActionQueue to make persisting the queue simpler for the consumer.

Queuing was added as part of #419

Why is it important?

Retry actions on edge will be implemented in the dispatcher by interacting with the queue. Moving all of the control flow for the queue to the dispatcher makes it more straightforward to understand and debug

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Follow guide in #419

Related issues

@michel-laterman michel-laterman added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Cleanup labels Sep 6, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 6, 2022

This pull request does not have a backport label. Could you fix it @michel-laterman? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

Move queue management actions to the dispatcher from the fleet-server
in order to help with future work to add a retry mechanism. Add a
PersistedQueue type which wrap the ActionQueue to make persisting the
queue simpler for the consumer.
@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 6, 2022

❕ Build Aborted

Either there was a build timeout or someone aborted the build.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-13T13:54:19.819+0000

  • Duration: 122 min 18 sec

Test stats 🧪

Test Results
Failed 0
Passed 4923
Skipped 17
Total 4940

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 6, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 97.333% (73/75) 👍
Files 67.521% (158/234) 👍
Classes 68.192% (313/459) 👍 0.069
Methods 52.132% (868/1665) 👎 -0.063
Lines 38.515% (9381/24357) 👍 0.026
Conditionals 100.0% (0/0) 💚

@michel-laterman michel-laterman marked this pull request as ready for review September 6, 2022 21:46
@michel-laterman michel-laterman requested a review from a team as a code owner September 6, 2022 21:46
@michel-laterman michel-laterman requested review from aleksmaus, michalpristas and blakerouse and removed request for a team September 6, 2022 21:46
@michel-laterman michel-laterman changed the base branch from main to feature-arch-v2 September 7, 2022 18:01
@michel-laterman michel-laterman requested a review from a team as a code owner September 7, 2022 18:01
@michel-laterman
Copy link
Contributor Author

rebasing on github is mesy I'll make a new PR for v2 without any of the garbage

@michel-laterman michel-laterman changed the base branch from feature-arch-v2 to main September 9, 2022 19:25
@mergify
Copy link
Contributor

mergify bot commented Sep 9, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b queue-in-dispatch upstream/queue-in-dispatch
git merge upstream/main
git push upstream queue-in-dispatch

@michel-laterman
Copy link
Contributor Author

Uses fixes from the v2 attempt: #1109

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Change looks good.

f.log.Error(err.Error())
actions := make([]fleetapi.Action, len(resp.Actions))
for idx, a := range resp.Actions {
actions[idx] = a
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of this forloop copy should work.

copy(actions, resp.Actions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, loop was the original implementation. i'll change to copy

@michel-laterman
Copy link
Contributor Author

/test

@michel-laterman
Copy link
Contributor Author

/test

@cmacknz
Copy link
Member

cmacknz commented Sep 13, 2022

The Mac build being broken is a known issue and is not specific to this PR, main just updated to switch to Github actions which should help. There is an open investigation with the CI team about why the Mac workers aren't reliable.

@michel-laterman
Copy link
Contributor Author

Closing, v2 PR was merged as the feature has been pushed to 8.6

@michel-laterman michel-laterman deleted the queue-in-dispatch branch April 12, 2023 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants