dummy_log_generator 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 760e8bbf26f9bfcc32494aed36086f062ee5fe28
4
- data.tar.gz: 64cfb639cc486f51dcf403020b5085c5dc9216ee
3
+ metadata.gz: 763e3b1f88736bd01458802295b72b701a55b6f5
4
+ data.tar.gz: 7a4d73d333d054750f71f99ba5ee0692a5deac3d
5
5
  SHA512:
6
- metadata.gz: 0958e911b83801d2b133b2d25689e930f3dc3c0771ba87f7fca57e45a25599fa6bed97d5f8aad6ee448e5cd4a4dbb3dcd0f766717c77a0cbd7cd6b7cae5bf8c3
7
- data.tar.gz: 6ca6c0a19b9740d2b8063094427eb6acc723d5b41bc84957bcdce6c2d83d9b6246f65e58ecc37b58babc5f0d3fc292d5c4920020215645bbb510f0f50fd01395
6
+ metadata.gz: 21337c2b2f2b18d9d981d66cf1b0b8125dfaadee0860376b546e46fd9a3f5fbc84747b8176318429b934d8cc157fc54a270e335f03eee7a66cf1e65daf29ae5e
7
+ data.tar.gz: 3de501d065779d73c4253ee831f38f98198eb22aefb518421bc09efaafc35063655bc232becda1eca80f4666035615623be94d9bc67735b5441c26a0a477f568
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.2.2 (2014/01/15)
2
+
3
+ Enhancement:
4
+
5
+ * Add CLI options to `dummy_log_generator` command
6
+
1
7
  ### 0.2.1
2
8
 
3
9
  Change:
data/README.md CHANGED
@@ -43,7 +43,7 @@ Create a configuration file. A sample configuration is as follows:
43
43
  ```ruby
44
44
  # dummy_log_generator.conf
45
45
  configure 'sample' do
46
- output dummy.log
46
+ output "dummy.log"
47
47
  rate 500
48
48
  delimiter "\t"
49
49
  labeled true
@@ -71,6 +71,27 @@ id:0423 time:[2013-11-19 02:34:58] level:DEBUG method:GET uri:/api/v1/people
71
71
  id:0424 time:[2013-11-19 02:34:58] level:WARN method:POST uri:/api/v1/textdata reqtime:2.930590441869852 foobar:XEZ5bQsh
72
72
  ```
73
73
 
74
+ ### CLI Options
75
+
76
+ ```
77
+ $ dummy_log_generator help start
78
+ Usage:
79
+ dummy_log_generator start
80
+
81
+ Options:
82
+ -c, [--config=CONFIG] # Config file
83
+ # Default: dummy_log_generator.conf
84
+ -r, [--rate=N] # Number of generating messages per second
85
+ -o, [--output=OUTPUT] # Output file
86
+ -m, [--message=MESSAGE] # Output message
87
+ -d, [--daemonize] # Daemonize. Stop with `dummy_log_generator stop`
88
+ -w, [--workers=N] # Number of parallels
89
+ [--worker-type=WORKER_TYPE]
90
+ # Default: process
91
+ -p, [--pid-path=PID_PATH]
92
+ # Default: dummy_log_generator.pid
93
+ ```
94
+
74
95
  ### Configuration Parameters
75
96
 
76
97
  Following parameters in the configuration file are available:
@@ -97,11 +118,11 @@ Following parameters in the configuration file are available:
97
118
 
98
119
  * field
99
120
 
100
- Define data fields to generate. `message` and `field` are ignored.
121
+ Define data fields to generate. `message` and `input` options are ignored.
101
122
 
102
123
  * input
103
124
 
104
- Use this if you want to write messages by reading lines of an input file in rotation. `field` is ignored.
125
+ Use this if you want to write messages by reading lines of an input file in rotation. `message` is ignored.
105
126
 
106
127
  * message
107
128
 
@@ -189,7 +210,7 @@ Usage:
189
210
  dummy_log_generator_simple
190
211
 
191
212
  Options:
192
- [--sync] # Use fsync(2) or not
213
+ [--sync] # Set `IO#sync=true`
193
214
  -s, [--second=N] # Duration of running in second
194
215
  # Default: 1
195
216
  -p, [--parallel=N] # Number of processes to run in parallel
@@ -233,6 +254,10 @@ Options:
233
254
 
234
255
  There is a [fluent-plugin-dummydata-producer](https://github.com/tagomoris/fluent-plugin-dummydata-producer), but I wanted to output dummy data to a log file, and I wanted a standalone tool.
235
256
 
257
+ ## Related Articles
258
+
259
+ * [Fluentd のベンチマークテストに使える dummy_log_generator](http://qiita.com/sonots/items/750da77a18e62852a02f)
260
+
236
261
  ## ToDO
237
262
 
238
263
  1. write tests
@@ -5,7 +5,7 @@ module DummyLogGeneratorSimple
5
5
  class CLI < Thor
6
6
  default_command :start
7
7
  desc "start", "Start a dummy_log_generator"
8
- option :sync, :type => :boolean, :desc => 'Use fsync(2) or not'
8
+ option :sync, :type => :boolean, :desc => 'Set `IO#sync=true`'
9
9
  option :second, :aliases => ["-s"], :type => :numeric, :default => 1, :desc => 'Duration of running in second'
10
10
  option :parallel, :aliases => ["-p"], :type => :numeric, :default => 1, :desc => 'Number of processes to run in parallel'
11
11
  option :output, :aliases => ["-o"], :type => :string, :default => 'dummy.log', :desc => 'Output file'
@@ -14,12 +14,14 @@ module DummyLogGenerator
14
14
  end
15
15
 
16
16
  desc "start", "Start a dummy_log_generator"
17
- option :config, :aliases => ["-c"], :type => :string, :default => 'dummy_log_generator.conf'
18
- option :rate, :aliases => ["-r"], :type => :numeric
17
+ option :config, :aliases => ["-c"], :type => :string, :default => 'dummy_log_generator.conf', :desc => 'Config file'
18
+ option :rate, :aliases => ["-r"], :type => :numeric, :desc => 'Number of generating messages per second'
19
+ option :output, :aliases => ["-o"], :type => :string, :desc => 'Output file'
20
+ option :message, :aliases => ["-m"], :type => :string, :desc => 'Output message'
19
21
  # options for serverengine
20
- option :daemonize, :aliases => ["-d"], :type => :boolean
21
- option :workers, :aliases => ["-w"], :type => :numeric
22
- option :worker_type, :type => :string, :default => 'process'
22
+ option :daemonize, :aliases => ["-d"], :type => :boolean, :desc => 'Daemonize. Stop with `dummy_log_generator stop`'
23
+ option :workers, :aliases => ["-w"], :type => :numeric, :desc => 'Number of parallels'
24
+ option :worker_type, :type => :string, :default => 'process'
23
25
  def start
24
26
  @options = @options.dup # avoid frozen
25
27
  dsl =
@@ -29,7 +31,9 @@ module DummyLogGenerator
29
31
  DummyLogGenerator::Dsl.new
30
32
  end
31
33
  @options[:setting] = dsl.setting
32
- @options[:rate] ||= dsl.setting.rate
34
+ dsl.setting.rate = options[:rate] if options[:rate]
35
+ dsl.setting.output = options[:output] if options[:output]
36
+ dsl.setting.message = options[:message] if options[:message]
33
37
  # options for serverengine
34
38
  @options[:workers] ||= dsl.setting.workers
35
39
 
@@ -1,3 +1,3 @@
1
1
  module DummyLogGenerator
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -10,7 +10,7 @@ module DummyLogGenerator
10
10
 
11
11
  def reload
12
12
  @generator = Generator.new(config[:setting])
13
- @rate = config[:rate]
13
+ @rate = config[:setting].rate
14
14
 
15
15
  output = config[:setting].output
16
16
  if output.respond_to?(:write) and output.respond_to?(:close)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dummy_log_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2014-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor