-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
WIP: Added support for log policy and log rate limit in conmon #4663
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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.
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.
Do we need the rate limit specified if the policy is
ignore
orpassthrough
?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.
A rate limit sure makes no sense for ignore or passthrough (which is the current unrestricted behavior, btw). How do you think should the CLI behave here, error out in that case, ignore, warn?
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.
So with no changes by the user, they will get
passthrough
. So that case should work today, which I think this code as it stands will raise an error.If they specify
ignore
orpassthrough
, then they should not specify a rate, and it should be an error if they do.If they specify
backpressure
ordrop
, then they must specify the rate.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.
Alright, makes perfect sense.
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.
Added the checks to https://github.com/syedriko/libpod/blob/004258dd4343d055876137d490ca3b2cbff68f15/pkg/spec/createconfig.go#L290
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.
We're writing to files and the file writes block until the file is written, so the current default is "backpressure" with no rate-limit. I think you could simplify validation so that rate-limit is optional regardless of policy. The "ignore" policy trivially respects any rate-limit (even 0) There is no such thing as "passthrough" - the existing behaviour is backpressure with no rate-limit.
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.
The semantics starts to get interesting if we consider where the backpressure comes from, from the code we're looking at, where the rate would sure apply, or downstream from this code. In that frame of reference, how would we implement drop without a rate limit, by making the log fd non-blocking, etc?
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.
A non-blocking partial write followed by a rate calculation I'd say.
The whole thing would be simpler as a poll loop with non-blocking reads/writes and a timer fd.
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.
Without a rate limit there's no basis for calculation though. A simple implementation can attempt to write to the non-blocking log fd and drop on seeing EAGAIN. A more involved one could poll() the fd and flip a "drop" flag.
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.
For backpressure there's nothing to calculate, you just block on write and delay reading as a consequence - the downstream determines how fast you go. For drop what you describe is right, but I would add a small buffer to avoid dropping due to minor jitters in read/write rate. Then drop on read with buffer-full.