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

Preserve component state on upgrade #2207

Merged
merged 4 commits into from
Feb 1, 2023

Conversation

michalpristas
Copy link
Contributor

@michalpristas michalpristas commented Jan 30, 2023

What does this PR do?

This PR copies run directory from stale agent to a new version of agent. Component can then pick up the state and continue where it was interrupted. This prevents creating duplicate events.

Why is it important?

Without this component loses state and can process whole file (in case of logs) again generating a lot of duplicate entries

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/fragments using the changelog tool

Fixes: #2136

@michalpristas michalpristas added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent Label for the Agent team backport-v8.6.0 Automated backport with mergify labels Jan 30, 2023
@michalpristas michalpristas requested a review from a team as a code owner January 30, 2023 13:33
@michalpristas michalpristas self-assigned this Jan 30, 2023
@michalpristas michalpristas requested review from AndersonQ and michel-laterman and removed request for a team January 30, 2023 13:33
@michalpristas michalpristas linked an issue Jan 30, 2023 that may be closed by this pull request
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 30, 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-02-01T14:40:00.793+0000

  • Duration: 22 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 4889
Skipped 13
Total 4902

💚 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.

  • 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 Jan 30, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.333% (59/60) 👍
Files 69.082% (143/207) 👍
Classes 68.514% (272/397) 👍
Methods 53.772% (834/1551) 👎 -0.064
Lines 39.158% (9092/23219) 👎 -0.082
Conditionals 100.0% (0/0) 💚

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.

Looks good, be sure to revert the defaultBeatVersion before merge.

@@ -4,4 +4,4 @@

package version

const defaultBeatVersion = "8.7.0"
const defaultBeatVersion = "8.6.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be removed before merge 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooh

@michalpristas michalpristas merged commit 9c03fae into elastic:main Feb 1, 2023
mergify bot pushed a commit that referenced this pull request Feb 1, 2023
Preserve component state on upgrade (#2207)

(cherry picked from commit 9c03fae)
michalpristas added a commit that referenced this pull request Feb 1, 2023
Preserve component state on upgrade (#2207)

(cherry picked from commit 9c03fae)

Co-authored-by: Michal Pristas <michal.pristas@gmail.com>
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 bug Something isn't working Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The component run directory must be copied on upgrade
3 participants