-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve flush_interval handling #1442
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,7 @@ def write(chunk); end # dummy | |
assert_equal [], @i.buffer_config.chunk_keys | ||
assert_equal 8, @i.buffer_config.flush_thread_count | ||
assert_equal 10, @i.buffer_config.flush_interval | ||
assert_equal :interval, @i.buffer_config.flush_mode | ||
assert @i.buffer_config.flush_at_shutdown | ||
|
||
assert_equal 8*1024*1024, @i.buffer.chunk_limit_size | ||
|
@@ -131,6 +132,7 @@ def write(chunk); end # dummy | |
assert @i.buffer_config.retry_forever | ||
assert_equal 60*60, @i.buffer_config.retry_max_interval | ||
assert_equal :block, @i.buffer_config.overflow_action | ||
assert_equal :default, @i.buffer_config.flush_mode | ||
|
||
assert [email protected]_key_tag | ||
assert_equal [], @i.chunk_keys | ||
|
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.
It looks better to set
:interval
whenflush_mode
is:default
, even whentimekey
is specified, here:https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/output.rb#L292
We need to know
flush_interval
is set in<buffer>
section or not before setting:interval
... how about to addhas_flush_interval
beforesuper
as same withhas_buffer_section
?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.
And it's better to warn when both of
flush_interval
andflush_mode lazy
(or immediate) are configured explicitly by users (these are exclusive parameters).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.
https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/output.rb#L293
From above line,
:default
is changed to:lazy
or:interval
so:default
is not appeared here, right?It seems good.
If so, should we raise an ConfigError when
flush_interval
andflush_mode lazy
are set explictly?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.
I mean to set
@flush_mode = :interval
at L293 whenflush_interval
is explicitly specified in configuration even if@chunk_key_time
is true.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.
If we doesn't take care about compatibility layer, it's better to raise configuration errors when both of
flush_mode lazy
andflush_interval
are specified in configuration file.But compatibility layer may specify these both if a plugin is TimeSlicedOutput and
flush_interval
exists in configuration. So we can't raise errors for such cases.warn
is better.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.
This means we should use
:interval
with following configuration?And warning for follwing configuration?
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.
1st example: No. It depends on default of plugins, and
output.rb
should warn about ignoredflush_interval
when plugins' default is notinterval
.My first point is that we cannot know the
:interval
set in@flush_mode
is from plugin default or configuraitons at L314 (because it can be set at L293). So we should checkconf
beforesuper
to show appropriate warning.2nd example: No. IMO it's better to raise error for inconsistent configuration.
The last my comment was wrong, because
Fluent::Compat::TimeSlicedOutput#configure
will setflush_mode
asinterval
ifconf
hasflush_interval
. So we can raise exception if both offlush_mode lazy
andflush_interval ...
are specified in configurations explicitly.