Skip to content

Commit

Permalink
Use dummy input instead of dummer, use dummy_server
Browse files Browse the repository at this point in the history
  • Loading branch information
riywo committed Jun 12, 2016
1 parent ff316ae commit 8bb0ee7
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 111 deletions.
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

.PHONY: test install streams firehose producer dummer hello $(wildcard test/test_*.rb) $(wildcard test/**/test_*.rb)
.PHONY: test install benchmark benchmark-streams benchmark-producer hello $(wildcard test/test_*.rb) $(wildcard test/**/test_*.rb)

all:
bundle install
bundle exec rake
bundle exec rake binaries

test:
bundle exec rake test

install:
bundle exec rake install:local

streams:
bundle exec fluentd -c benchmark/streams.conf -vv
benchmark: benchmark-streams benchmark-producer

firehose:
bundle exec fluentd -c benchmark/firehose.conf -vv
benchmark-streams:
bundle exec rake benchmark TYPE=streams

producer:
bundle exec fluentd -c benchmark/producer.conf -vv

dummer:
bundle exec dummer -c benchmark/dummer.conf
benchmark-producer:
bundle exec rake benchmark TYPE=producer

hello:
echo Hello World | bundle exec fluent-cat --none dummy
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,9 @@ To launch `fluentd` process with this plugin for development, follow the steps b
git clone https://github.com/awslabs/aws-fluent-plugin-kinesis.git
cd aws-fluent-plugin-kinesis
make # will install gems and download KPL jar file and extract binaries
make [stream/firehose/producer]
bundle exec fluentd -c /path/to/fluent.conf

Then, in another terminal, run the command below. It will emit one record.

make hello

Also, you can test streaming log data by `dummer`:

make dummer # keep writing to /tmp/dummy.log
If you want to run benchmark, use `make benchmark`.

## Contributing

Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Rake::TestTask.new do |test|
end

load 'kinesis_producer/tasks/binary.rake'

Rake::Task[:build].enhance [:binaries]
Rake::Task[:test].enhance [:binaries]

load 'benchmark/task.rake'
13 changes: 0 additions & 13 deletions benchmark/dummer.conf

This file was deleted.

Empty file added benchmark/dummy.conf
Empty file.
24 changes: 0 additions & 24 deletions benchmark/firehose.conf

This file was deleted.

28 changes: 0 additions & 28 deletions benchmark/producer.conf

This file was deleted.

24 changes: 0 additions & 24 deletions benchmark/streams.conf

This file was deleted.

72 changes: 72 additions & 0 deletions benchmark/task.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

require_relative '../test/dummy_server'

task :benchmark do
server = DummyServer.start
conf = profile_conf(ENV["TYPE"] || 'streams', ENV["RATE"] || 1000, server)
pid = spawn("bundle exec fluentd -i '#{conf}' -c benchmark/dummy.conf")
sleep 10
Process.kill("TERM", pid)
Process.wait
puts "Results: requets: #{server.requests.size}, raw_records: #{server.raw_records.size}, records: #{server.records.size}"
server.shutdown
end

def profile_conf(type, rate, server)
additional_conf = case type
when 'streams', 'firehose'
<<-EOS
endpoint https://localhost:#{server.port}
ssl_verify_peer false
EOS
when 'producer'
<<-EOS
debug true
<kinesis_producer>
custom_endpoint localhost
port #{server.port}
verify_certificate false
record_max_buffered_time 1000
log_level error
</kinesis_producer>
EOS
end

conf = <<-EOS
<source>
@type dummy
tag dummy
rate #{rate}
</source>
<match dummy>
@type kinesis_#{type}
flush_interval 1
buffer_chunk_limit 1m
try_flush_interval 0.1
queued_chunk_flush_interval 0.01
@log_level debug
num_threads 100
region ap-northeast-1
stream_name fluent-plugin-test
#{additional_conf}
</match>
EOS
conf
end
2 changes: 0 additions & 2 deletions fluent-plugin-kinesis.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pry-byebug", ">= 3.3.0"
spec.add_development_dependency "pry-stack_explorer", ">= 0.4.9.2"
spec.add_development_dependency "net-empty_port", ">= 0.0.2"
# Due to the version conflict of msgpack between fluentd-0.14 and fluent-logger-0.5.1
# spec.add_development_dependency "dummer", ">= 0.4.0"
spec.add_development_dependency "rubyzip", ">= 1.0.0"
spec.add_development_dependency "mocha", ">= 1.1.0"
spec.add_development_dependency "webmock", ">= 1.24.2"
Expand Down
4 changes: 4 additions & 0 deletions test/dummy_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def requests
@requests
end

def raw_records
@accepted_records
end

def records
flatten_records(@accepted_records)
end
Expand Down

0 comments on commit 8bb0ee7

Please sign in to comment.