-
Notifications
You must be signed in to change notification settings - Fork 204
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 support for docker containers restart in loki.source.docker #742
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
wildum
commented
May 2, 2024
thampiotr
reviewed
May 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got one concern about the resource leak, but it looks okay otherwise!
thampiotr
approved these changes
May 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, otherwise LGTM
wildum
force-pushed
the
fix-loki-source-docker-logs-restart
branch
from
May 7, 2024 14:58
160f1c7
to
ddd8332
Compare
github-actions bot
pushed a commit
that referenced
this pull request
May 8, 2024
* Attempt to restart docker target for loki source at a fixed interval to support containers restart * add test * add missing target cleanup * improve test readability * rename config option (cherry picked from commit 5d777a5)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
backport release/v1.1
backport-to-agent
PR should be backported to the agent repo.
frozen-due-to-age
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.
PR Description
The loki.source.docker does not attempt to re-collect logs from a docker container target that has exited. The only way to continue collecting the logs from the target is to remove the target from the component and add it again.
This means that if a target is terminated and restarted within a discovery.docker interval, it will not be removed from the loki.source.docker component and the logs won't be collected anymore.
This fix adds a retry strategy that attempts to collect logs from the current running targets every 5 seconds. If the task is already running it does not do anything. If a task was stopped it will be restarted.
Which issue(s) this PR fixes
Fixes #278
PR Checklist