Skip to content

Commit

Permalink
in_tail: Use size config type for read_bytes_limit_per_second
Browse files Browse the repository at this point in the history
Because file size should be specified with SI prefix
instead of raw numbers.

Signed-off-by: Hiroshi Hatake <hatake@clear-code.com>
  • Loading branch information
cosmo0920 committed Dec 1, 2020
1 parent 7d11b46 commit 544194a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_tail.rb
Expand Up @@ -82,7 +82,7 @@ def initialize
desc 'The number of reading lines at each IO.'
config_param :read_lines_limit, :integer, default: 1000
desc 'The number of reading bytes per second'
config_param :read_bytes_limit_per_second, :integer, default: -1
config_param :read_bytes_limit_per_second, :size, default: -1
desc 'The interval of flushing the buffer for multiline format'
config_param :multiline_flush_interval, :time, default: nil
desc 'Enable the option to emit unmatched lines.'
Expand Down
12 changes: 8 additions & 4 deletions test/plugin/test_in_tail.rb
Expand Up @@ -252,10 +252,14 @@ def test_emit_with_read_lines_limit(data)
FileUtils.rm_f("#{TMP_DIR}/tail.txt")
end

data("flat 8192 bytes, 10 events" => [:flat, 100, 8192, 10],
"flat #{8192*10} bytes, 20 events" => [:flat, 100, (8192 * 10), 20],
"parse #{8192*3} bytes, 10 events" => [:parse, 100, (8192 * 3), 10],
"parse #{8192*10} bytes, 20 events" => [:parse, 100, (8192 * 10), 20])
data("flat 8192 bytes, 10 events" => [:flat, 100, 8192, 10],
"flat #{8192*10} bytes, 20 events" => [:flat, 100, (8192 * 10), 20],
"parse #{8192*3} bytes, 10 events" => [:parse, 100, (8192 * 3), 10],
"parse #{8192*10} bytes, 20 events" => [:parse, 100, (8192 * 10), 20],
"flat 8k bytes with unit, 10 events" => [:flat, 100, "8k", 10],
"flat #{8*10}k bytes with unit, 20 events" => [:flat, 100, "#{8*10}k", 20],
"parse #{8*3}k bytes with unit, 10 events" => [:parse, 100, "#{8*3}k", 10],
"parse #{8*10}k bytes with unit, 20 events" => [:parse, 100, "#{8*10}k", 20])
def test_emit_with_read_bytes_limit_per_second(data)
config_style, limit, limit_bytes, num_events = data
case config_style
Expand Down

0 comments on commit 544194a

Please sign in to comment.