fix(agent): Restore setup order of stateful plugins to Init() then SetState() #16123
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.
Summary
PR #15170 changed the startup sequence of stateful plugins from
Init -> SetState
toSetState -> Init
and in turn broke all stateful users (inputs.tail
,inputs.docker_log
,inputs.win_eventlog
andprocessors.dedup
) to make starlark state-persistence work.As a code sequence of
Init -> SetState
is the expected behavior and what works for all previous users, this PR restores the old order and fixescommon.starlark
to also work with this sequencing. The PR furthermore adds unit-tests where possible to make sure the sequence works. Last but not least, the PR updates the spec and also defines the shutdown order to beClose/Stop -> GetState
.Checklist
Related issues
resolves #16037