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

Add checks to ensure reloading of units if the configuration actually changed. #34346

Merged
merged 2 commits into from
Jan 23, 2023

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Jan 23, 2023

What does this PR do?

Improved the managerV2 to not perform reloading of the output or inputs if the configuration has not changed.

Why is it important?

Before this change any change in a single unit (including state and log level) would result in all units being reloaded even if that units configuration didn't change. To make it worse when stopOnEmptyUnits is true any little change, like log level would cause the entire beat to restart.

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.

Related issues

@blakerouse blakerouse added Team:Elastic-Agent Label for the Agent team backport-v8.6.0 Automated backport with mergify labels Jan 23, 2023
@blakerouse blakerouse self-assigned this Jan 23, 2023
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jan 23, 2023
@blakerouse blakerouse marked this pull request as ready for review January 23, 2023 15:14
@blakerouse blakerouse requested a review from a team as a code owner January 23, 2023 15:14
@blakerouse blakerouse requested review from cmacknz and fearful-symmetry and removed request for a team January 23, 2023 15:14
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 23, 2023

💚 Build Succeeded

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

Expand to view the summary

Build stats

  • Start Time: 2023-01-23T15:14:29.579+0000

  • Duration: 62 min 52 sec

Test stats 🧪

Test Results
Failed 0
Passed 7503
Skipped 339
Total 7842

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

@blakerouse
Copy link
Contributor Author

I have tested this locally with the Elastic Agent with current 8.6.1 commits (including my fix for missing output configuration) and I am seeing this fix the behavior of the beats being restarted when they don't need to be.

I have tested:

  • Changing Log Level (no restart)
  • Changing Integration (no restart)
  • Changing output (restart)

@blakerouse
Copy link
Contributor Author

I think we should get this merged ASAP to be in 8.6.1, I think the change is very safe and easy to follow.

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Agreed, review looks good. I haven't had a chance to test it yet but I can do that while we wait for the 8.6.1 backport to be ready.

@blakerouse blakerouse merged commit 5b1f828 into elastic:main Jan 23, 2023
@blakerouse blakerouse deleted the v2-manager-stable branch January 23, 2023 16:30
mergify bot pushed a commit that referenced this pull request Jan 23, 2023
… changed. (#34346)

* Add checks to ensure reloading of units if the configuration actually changed.

* Add changelog entry.

(cherry picked from commit 5b1f828)
cmacknz added a commit to cmacknz/beats that referenced this pull request Jan 23, 2023
cmacknz added a commit that referenced this pull request Jan 23, 2023
mergify bot pushed a commit that referenced this pull request Jan 23, 2023
The format step was skipped in
#34346

(cherry picked from commit 870215c)

# Conflicts:
#	x-pack/libbeat/management/managerV2.go
@cmacknz
Copy link
Member

cmacknz commented Jan 23, 2023

Tested locally as well, confirming this works as expected.

blakerouse pushed a commit that referenced this pull request Jan 23, 2023
cmacknz added a commit that referenced this pull request Jan 23, 2023
… configuration actually changed. (#34348)

* Add checks to ensure reloading of units if the configuration actually changed. (#34346)

* Add checks to ensure reloading of units if the configuration actually changed.

* Add changelog entry.

(cherry picked from commit 5b1f828)

* Run make check and commit the changes. (#34349)

The format step was skipped in
#34346

Co-authored-by: Blake Rouse <[email protected]>
Co-authored-by: Craig MacKenzie <[email protected]>
@cmacknz
Copy link
Member

cmacknz commented Jan 23, 2023

@oren-zohar you will want to pick up this change in Cloudbeat to avoid unnecessary process restarts when the agent policy changes.

chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
… changed. (#34346)

* Add checks to ensure reloading of units if the configuration actually changed.

* Add changelog entry.
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.6.0 Automated backport with mergify Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beats managed by agent should not restart unless the output configuration has actually changed
3 participants