Skip to content

Commit

Permalink
Add size param to specify how many events packed
Browse files Browse the repository at this point in the history
  • Loading branch information
ganmacs committed Aug 7, 2016
1 parent 9d70938 commit 10dfefd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/fluent/plugin/in_dummy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class DummyInput < Input

desc "The value is the tag assigned to the generated events."
config_param :tag, :string
desc "It configures how many events packed in event."
config_param :size, :integer, default: 1
desc "It configures how many events to generate per second."
config_param :rate, :integer, default: 1
desc "If specified, each generated event has an auto-incremented key field."
Expand Down Expand Up @@ -90,7 +92,13 @@ def run

def emit(num)
begin
num.times { router.emit(@tag, Fluent::Engine.now, generate()) }
if @size > 1
num.times do
router.emit_array(@tag, Array.new(@size) { [Fluent::Engine.now, generate] })
end
else
num.times { router.emit(@tag, Fluent::Engine.now, generate) }
end
rescue => _
# ignore all errors not to stop emits by emit errors
end
Expand Down

0 comments on commit 10dfefd

Please sign in to comment.