-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Refactor queues to be initialized explicitly instead of through global registry #34952
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
leehinman
requested changes
Mar 28, 2023
Collaborator
leehinman
approved these changes
Mar 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an entirely internal change to the queue initialization, it should have no visible effect.
Historically, queues have been registered in a global lookup table based on their configuration name, and dynamically created on Beats startup by querying the registry for the appropriate factory.
This already had some drawbacks in the past: complexity-wise, a dynamic global registry is some heavy lifting to account for exactly two possible values, and even in those two cases the factory methods used were not appropriate since the disk queue and memory queue took different parameters on creation (previously the disk queue handled this by ignoring factory parameters that didn't apply to it).
However, we will soon need to accommodate a third possible configuration (#34396). In this configuration, the queue type depends on the selected output, which is generally not known during Beats initialization (under Agent, beats are typically started with no output, and then receive their output in a second configuration pass via
(*BeatV2Manager).reloadOutput
). This means that we will need to be able to create or modify the queue after initialization.This PR does not go that far -- it's just a preparatory cleanup to make the impending refactor easier. This PR removes the queue's use of the global registry and associated factory methods. The code in
module.go
that used to handle the registry lookups now instead has explicit queue creation logic, which is clearer and will be easier to refactor into a more dynamic form in followup work.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksI have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.