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

policy monitor improvements #3470

Open
michel-laterman opened this issue Apr 16, 2024 · 0 comments
Open

policy monitor improvements #3470

michel-laterman opened this issue Apr 16, 2024 · 0 comments
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Fleet Label for the Fleet team

Comments

@michel-laterman
Copy link
Contributor

#1744 highlights issues caused by the monitor and coordinator
we are going to remove the coordinator with #3131.

However there are still improvements that we can make to the policy monitor:

  • We create a goroutine per agent policy, as the number of policy is low this is perfectly fine, but I think that logic could be handled by a single cleanup event loop in a single goroutine.
  • Improve handling when a large amount of policies are defined; monitorT.polices is a map[string]policyT. This works for low policy counts but will likely need to be another data structure such as an LRU cache in order to support larger counts

Other areas that may need more investigation are:

  • We are exposing internal fields from monitorT object in the test suite, we should hide all access to the internal field using accessor even if this is only for testing. This allow a single locking logic.
  • Looking at the code, It look like possible the usage of multiple internal fields into a watcher struct that would encapsulate more logic.
  • Internal state of the monitor bleeds into the goroutine execution, this make it harder to lock or prevent concurrent access to the resource. Encapsulating that logic into his own object would make it simple to test and verifies.
@jlind23 jlind23 added the Team:Fleet Label for the Fleet team label Apr 17, 2024
@ycombinator ycombinator added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Fleet Label for the Fleet team
Projects
None yet
Development

No branches or pull requests

3 participants