fluent-plugin-amplifier-filter 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a96b9a77928a922347d8f8397c8894f3c59a527
4
- data.tar.gz: da7c1ba756b5b8508edcce1ffbefe7bd1085b1e0
3
+ metadata.gz: 206214436b2ba5533fe99bff1f9b9cb72ba325b1
4
+ data.tar.gz: 5b39b1c5aaea9698811df778e0ab86454ffc73ae
5
5
  SHA512:
6
- metadata.gz: c759709df880360790144d80f7b33445c30dee5801fa32557b0f7b8bf22acaf049379f7b0d3dd83b19658c1ffebe624480dbbfb05b7ddf11e4e6d169b6049fea
7
- data.tar.gz: 78dadfd3bc126cdd6c45fb22f60f290720f5c17f14ae7d0cc55d78412b0a3680bfc4c1d4c4552926e63bcf6565493fb7501b8c639757dc3746fa508c6e3056ae
6
+ metadata.gz: 39c06d2e15faedd4820469073d254d3dc094957e3e9b39997811b57bc2c6d46d926d74466523251909cb8b957d747247b9bc355eab68fac80fe54b04c5d80f9f
7
+ data.tar.gz: da14b083393b81e9150d07cbed550308d9d279a7d49e61fefa2aba2cccf4daff5defb8c586f2402d809f83b115fe6bb4f855e6c23179f5c6f52a126c9453dc94
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.0
5
4
  - 2.1
6
5
  - 2.2
7
6
  - 2.3.0
data/README.md CHANGED
@@ -1,15 +1,37 @@
1
1
  # fluent-plugin-amplifier-filter
2
2
 
3
- ## Component
3
+ [Fluentd](http://fluentd.org) plugin to modify numeric values of specified fields. Useful for counting values of sampled data (by fluent-plugin-sampling-filter or etc).
4
4
 
5
- ### AmplifierFilterOutput
5
+ ## Configuration
6
6
 
7
- [Fluentd](http://fluentd.org) plugin to modify numeric values of specified fields, and Re-emit with modified tags. Useful for counting values of sampled data (by fluent-plugin-sampling-filter or etc).
7
+ ### AmplifierFilter
8
8
 
9
- ## Configuration
9
+ To do 10x for count values from messages 1/10 sampled, and to do 100x for 1/100 sampled:
10
+
11
+ <label @sampled>
12
+ <filter big.service> # I know its logs are sampled into 1/10
13
+ @type amplifier
14
+ ratio 10
15
+ key_names count, rate
16
+ </filter>
17
+
18
+ <filter huge.service> # I know its logs are sampled into 1/100
19
+ @type amplifier
20
+ ratio 100
21
+ key_pattern .*_(count|rate)$
22
+ </filter>
23
+
24
+ <match **>
25
+ # output result to visualization tools, or ....
26
+ </match>
27
+ </label>
28
+
29
+ There is an option to `floor`(bool) the result of amplifying numeric values into integer. Its default value is `false`.
10
30
 
11
31
  ### AmplifierFilterOutput
12
32
 
33
+ **NOTE: This output plugin is deprecated. Use 'amplifier' filter plugin instead.**
34
+
13
35
  To do x10 for messages 1/10 sampled, and to do x100 for messages 1/100 sampled:
14
36
 
15
37
  <match sampled_10.**>
@@ -44,46 +66,8 @@ To do x10 for messages 1/10 sampled, and to do x100 for messages 1/100 sampled:
44
66
  # output configurations where to send original/modified messages...
45
67
  </match>
46
68
 
47
- ### AmplifierFilter
48
-
49
- Filter version of AmplifierFilterOutput plugin.
50
- It depends on Fluentd 0.12 or later.
51
-
52
- <filter sampled_10.**>
53
- @type amplifier_filter
54
- ratio 10
55
- key_names counts,rates
56
- </filter>
57
-
58
- <filter sampled_100.**>
59
- @type amplifier_filter
60
- ratio 100
61
- key_names counts,rates
62
- </filter>
63
-
64
- <match sampled_10.**>
65
- # output configurations where to send original/modified messages...
66
- </match>
67
-
68
- <match sampled_100.**>
69
- # output configurations where to send original/modified messages...
70
- </match>
71
-
72
- `key_pattern`(regexp) useful insted of `key_names`, and `add_prefix` is also useful:
73
-
74
- <filter sampled_10.**>
75
- @type amplifier_filter
76
- ratio 10
77
- key_pattern .*_(count|rate)$
78
- </filter>
79
-
80
- <match sampled_10.**>
81
- # output configurations where to send original/modified messages...
82
- </match>
83
-
84
69
  ## TODO
85
70
 
86
- * consider what to do next
87
71
  * patches welcome!
88
72
 
89
73
  ## Copyright
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-amplifier-filter"
4
- gem.version = "0.3.0"
4
+ gem.version = "1.0.0"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.summary = %q{plugin to re-emit messages with amplified values}
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
15
  gem.require_paths = ["lib"]
16
16
 
17
- gem.add_runtime_dependency "fluentd", "< 0.14.0"
17
+ gem.add_runtime_dependency "fluentd", ">= 0.14.0"
18
18
  gem.add_development_dependency "bundler"
19
19
  gem.add_development_dependency "rake"
20
20
  gem.add_development_dependency "test-unit", "~> 3.1.0"
@@ -0,0 +1,79 @@
1
+ require 'fluent/plugin/filter'
2
+
3
+ class Fluent::Plugin::AmplifierFilter < Fluent::Plugin::Filter
4
+ Fluent::Plugin.register_filter('amplifier', self)
5
+ Fluent::Plugin.register_filter('amplifier_filter', self)
6
+
7
+ config_param :ratio, :float
8
+
9
+ config_param :key_names, :array, value_type: :string, default: nil
10
+ config_param :key_pattern, :string, default: nil
11
+
12
+ config_param :floor, :bool, default: false
13
+
14
+ def configure(conf)
15
+ super
16
+
17
+ if @key_names.nil? && @key_pattern.nil?
18
+ raise Fluent::ConfigError, "missing both of key_names and key_pattern"
19
+ end
20
+ if @key_names && @key_pattern
21
+ raise Fluent::ConfigError, "cannot specify both of key_names and key_pattern"
22
+ end
23
+ if @key_pattern
24
+ @key_pattern = Regexp.new(@key_pattern)
25
+ end
26
+
27
+ amp = @floor ? :amp_with_floor : :amp_without_floor
28
+ self.define_singleton_method(:amp, method(amp))
29
+
30
+ filter_method = @key_names ? :filter_with_names : :filter_with_patterns
31
+ self.define_singleton_method(:filter, method(filter_method))
32
+ end
33
+
34
+ def amp_without_floor(value)
35
+ value.to_f * @ratio
36
+ end
37
+
38
+ def amp_with_floor(value)
39
+ (value.to_f * @ratio).floor
40
+ end
41
+
42
+ def filter(tag, time, record)
43
+ if @key_names
44
+ filter_with_names(tag, time, record)
45
+ else
46
+ filter_with_patterns(tag, time, record)
47
+ end
48
+ end
49
+
50
+ def filter_with_names(tag, time, record)
51
+ updated = {}
52
+ @key_names.each do |key|
53
+ val = record[key]
54
+ next unless val
55
+ updated[key] = amp(val)
56
+ end
57
+ log.trace "amplifier", tag: tag, floor: @floor, ratio: @ratio, updated: updated, original: record
58
+ if updated.size > 0
59
+ record.merge(updated)
60
+ else
61
+ record
62
+ end
63
+ end
64
+
65
+ def filter_with_patterns(tag, time, record)
66
+ updated = {}
67
+ record.each_pair do |key, val|
68
+ next unless val
69
+ next unless @key_pattern.match(key)
70
+ updated[key] = amp(val)
71
+ end
72
+ log.trace "amplifier", tag: tag, floor: @floor, ratio: @ratio, updated: updated, original: record
73
+ if updated.size > 0
74
+ record.merge(updated)
75
+ else
76
+ record
77
+ end
78
+ end
79
+ end
@@ -1,86 +1 @@
1
- class Fluent::AmplifierFilter < Fluent::Filter
2
- Fluent::Plugin.register_filter('amplifier_filter', self)
3
-
4
- config_param :ratio, :float
5
-
6
- config_param :key_names, :string, default: nil
7
- config_param :key_pattern, :string, default: nil
8
-
9
- config_param :floor, :bool, default: false
10
-
11
- # Define `log` method for v0.10.42 or earlier
12
- unless method_defined?(:log)
13
- define_method("log") { $log }
14
- end
15
-
16
- def configure(conf)
17
- super
18
-
19
- if @key_names.nil? and @key_pattern.nil?
20
- raise Fluent::ConfigError, "missing both of key_names and key_pattern"
21
- end
22
- if not @key_names.nil? and not @key_pattern.nil?
23
- raise Fluent::ConfigError, "cannot specify both of key_names and key_pattern"
24
- end
25
- if @key_names
26
- @key_names = @key_names.split(',')
27
- end
28
- if @key_pattern
29
- @key_pattern = Regexp.new(@key_pattern)
30
- end
31
-
32
- amp = if @floor
33
- method(:amp_with_floor)
34
- else
35
- method(:amp_without_floor)
36
- end
37
- (class << self; self; end).module_eval do
38
- define_method(:amp, amp)
39
- end
40
- end
41
-
42
- def amp_without_floor(value)
43
- value.to_f * @ratio
44
- end
45
-
46
- def amp_with_floor(value)
47
- (value.to_f * @ratio).floor
48
- end
49
-
50
- def filter_stream(tag, es)
51
- new_es = Fluent::MultiEventStream.new
52
- if @key_names
53
- es.each {|time,record|
54
- updated = {}
55
- @key_names.each {|key|
56
- val = record[key]
57
- next unless val
58
- updated[key] = amp(val)
59
- }
60
- log.debug "amplifier tag:#{tag} floor:#{@floor} ratio:#{@ratio} updated:#{updated.to_json} record:#{record.to_json}"
61
- if updated.size > 0
62
- new_es.add(time, record.merge(updated))
63
- else
64
- new_es.add(time, record.dup)
65
- end
66
- }
67
- else @key_pattern
68
- es.each {|time,record|
69
- updated = {}
70
- record.keys.each {|key|
71
- val = record[key]
72
- next unless val
73
- next unless @key_pattern.match(key)
74
- updated[key] = amp(val)
75
- }
76
- log.debug "amplifier tag:#{tag} floor:#{@floor} ratio:#{@ratio} updated:#{updated.to_json} record:#{record.to_json}"
77
- if updated.size > 0
78
- new_es.add(time, record.merge(updated))
79
- else
80
- new_es.add(time, record.dup)
81
- end
82
- }
83
- end
84
- new_es
85
- end
86
- end if defined?(Fluent::Filter)
1
+ require_relative 'filter_amplifier'
@@ -1,33 +1,31 @@
1
- class Fluent::AmplifierFilterOutput < Fluent::Output
1
+ require 'fluent/plugin/output'
2
+
3
+ class Fluent::Output::AmplifierFilterOutput < Fluent::Plugin::Output
2
4
  Fluent::Plugin.register_output('amplifier_filter', self)
3
5
 
6
+ helpers :event_emitter
7
+
4
8
  config_param :ratio, :float
5
9
 
6
- config_param :key_names, :string, :default => nil
7
- config_param :key_pattern, :string, :default => nil
10
+ config_param :key_names, :array, value_type: :string, default: nil
11
+ config_param :key_pattern, :string, default: nil
8
12
 
9
- config_param :floor, :bool, :default => false
13
+ config_param :floor, :bool, default: false
10
14
 
11
- config_param :remove_prefix, :string, :default => nil
12
- config_param :add_prefix, :string, :default => nil
13
-
14
- # Define `log` method for v0.10.42 or earlier
15
- unless method_defined?(:log)
16
- define_method("log") { $log }
17
- end
15
+ config_param :remove_prefix, :string, default: nil
16
+ config_param :add_prefix, :string, default: nil
18
17
 
19
18
  def configure(conf)
20
19
  super
21
20
 
21
+ log.warn "'amplifier_filter' output plugin is deprecated. use 'amplifier' filter plugin instead."
22
+
22
23
  if @key_names.nil? and @key_pattern.nil?
23
24
  raise Fluent::ConfigError, "missing both of key_names and key_pattern"
24
25
  end
25
- if not @key_names.nil? and not @key_pattern.nil?
26
+ if @key_names && @key_pattern
26
27
  raise Fluent::ConfigError, "cannot specify both of key_names and key_pattern"
27
28
  end
28
- if @key_names
29
- @key_names = @key_names.split(',')
30
- end
31
29
  if @key_pattern
32
30
  @key_pattern = Regexp.new(@key_pattern)
33
31
  end
@@ -37,9 +35,7 @@ class Fluent::AmplifierFilterOutput < Fluent::Output
37
35
  else
38
36
  method(:amp_without_floor)
39
37
  end
40
- (class << self; self; end).module_eval do
41
- define_method(:amp, amp)
42
- end
38
+ self.define_singleton_method(:amp, amp)
43
39
 
44
40
  if not @remove_prefix and not @add_prefix
45
41
  raise Fluent::ConfigError, "missing both of remove_prefix and add_prefix"
@@ -61,7 +57,7 @@ class Fluent::AmplifierFilterOutput < Fluent::Output
61
57
  (value.to_f * @ratio).floor
62
58
  end
63
59
 
64
- def emit(tag, es, chain)
60
+ def process(tag, es)
65
61
  if @remove_prefix and
66
62
  ( (tag.start_with?(@removed_prefix_string) and tag.length > @removed_length) or tag == @remove_prefix)
67
63
  tag = tag[@removed_length..-1]
@@ -108,7 +104,5 @@ class Fluent::AmplifierFilterOutput < Fluent::Output
108
104
  }
109
105
  end
110
106
  router.emit_array(tag, pairs)
111
-
112
- chain.next
113
107
  end
114
108
  end
@@ -1,4 +1,5 @@
1
1
  require 'helper'
2
+ require 'fluent/test/driver/filter'
2
3
 
3
4
  class AmplifierFilterTest < Test::Unit::TestCase
4
5
  def setup
@@ -26,27 +27,27 @@ class AmplifierFilterTest < Test::Unit::TestCase
26
27
  key_pattern field.*
27
28
  ]
28
29
 
29
- def create_driver(conf = CONFIG, tag='test')
30
- Fluent::Test::FilterTestDriver.new(Fluent::AmplifierFilter, tag).configure(conf)
30
+ def create_driver(conf = CONFIG)
31
+ Fluent::Test::Driver::Filter.new(Fluent::Plugin::AmplifierFilter).configure(conf)
31
32
  end
32
33
 
33
34
  def test_configure
34
35
  assert_raise(Fluent::ConfigError) {
35
- d = create_driver('')
36
+ create_driver('')
36
37
  }
37
38
  assert_raise(Fluent::ConfigError) {
38
- d = create_driver(%[
39
+ create_driver(%[
39
40
  ratio 1
40
41
  ])
41
42
  }
42
43
  assert_nothing_thrown {
43
- d = create_driver(%[
44
+ create_driver(%[
44
45
  ratio 1
45
46
  key_names field1
46
47
  ])
47
48
  }
48
49
  assert_nothing_raised {
49
- d = create_driver(%[
50
+ create_driver(%[
50
51
  ratio 1
51
52
  key_pattern field\d+
52
53
  ])
@@ -62,23 +63,22 @@ class AmplifierFilterTest < Test::Unit::TestCase
62
63
  # ratio 1.5
63
64
  # key_names foo,bar,baz
64
65
  # ]
65
- d1 = create_driver(CONFIG, 'test.service')
66
- d1.run do
67
- d1.filter({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
68
- d1.filter({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
66
+ d1 = create_driver(CONFIG)
67
+ d1.run(default_tag: 'test.service') do
68
+ d1.feed({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
69
+ d1.feed({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
69
70
  end
70
- filtered = d1.filtered_as_array
71
+ filtered = d1.filtered.map{|e| e.last }
71
72
  assert_equal 2, filtered.length
72
- assert_equal 'test.service', filtered[0][0] # tag
73
73
 
74
- first = filtered[0][2]
74
+ first = filtered[0]
75
75
  assert_equal 'first', first['name']
76
76
  assert_equal 15 , first['foo']
77
77
  assert_equal 1.5 , first['bar']
78
78
  assert_equal 30 , first['baz']
79
79
  assert_equal 50 , first['zap']
80
80
 
81
- second = filtered[1][2]
81
+ second = filtered[1]
82
82
  assert_equal 'second', second['name']
83
83
  assert_equal 15 , second['foo']
84
84
  assert_equal 3 , second['bar']
@@ -92,23 +92,22 @@ class AmplifierFilterTest < Test::Unit::TestCase
92
92
  # floor yes
93
93
  # key_pattern field.*
94
94
  # ]
95
- d3 = create_driver(CONFIG2, 'test.service')
96
- d3.run do
97
- d3.filter({'name' => 'first', 'fieldfoo' => 10, 'fieldbar' => 1, 'fieldbaz' => 20, 'zap' => 50})
98
- d3.filter({'name' => 'second', 'fieldfoo' => '10', 'fieldbar' => '2', 'fieldbaz' => '40', 'zap' => '50'})
95
+ d3 = create_driver(CONFIG2)
96
+ d3.run(default_tag: 'test.service') do
97
+ d3.feed({'name' => 'first', 'fieldfoo' => 10, 'fieldbar' => 1, 'fieldbaz' => 20, 'zap' => 50})
98
+ d3.feed({'name' => 'second', 'fieldfoo' => '10', 'fieldbar' => '2', 'fieldbaz' => '40', 'zap' => '50'})
99
99
  end
100
- filtered = d3.filtered_as_array
100
+ filtered = d3.filtered.map {|e| e.last }
101
101
  assert_equal 2, filtered.length
102
- assert_equal 'test.service', filtered[0][0] # tag
103
102
 
104
- first = filtered[0][2]
103
+ first = filtered[0]
105
104
  assert_equal 'first', first['name']
106
105
  assert_equal 7 , first['fieldfoo']
107
106
  assert_equal 0 , first['fieldbar']
108
107
  assert_equal 15 , first['fieldbaz']
109
108
  assert_equal 50 , first['zap']
110
109
 
111
- second = filtered[1][2]
110
+ second = filtered[1]
112
111
  assert_equal 'second', second['name']
113
112
  assert_equal 7 , second['fieldfoo']
114
113
  assert_equal 1 , second['fieldbar']
@@ -1,4 +1,5 @@
1
1
  require 'helper'
2
+ require 'fluent/test/driver/output'
2
3
 
3
4
  class AmplifierFilterOutputTest < Test::Unit::TestCase
4
5
  def setup
@@ -25,40 +26,40 @@ class AmplifierFilterOutputTest < Test::Unit::TestCase
25
26
  remove_prefix test
26
27
  ]
27
28
 
28
- def create_driver(conf = CONFIG, tag='test')
29
- Fluent::Test::OutputTestDriver.new(Fluent::AmplifierFilterOutput, tag).configure(conf)
29
+ def create_driver(conf = CONFIG)
30
+ Fluent::Test::Driver::Output.new(Fluent::Output::AmplifierFilterOutput).configure(conf)
30
31
  end
31
32
 
32
33
  def test_configure
33
34
  assert_raise(Fluent::ConfigError) {
34
- d = create_driver('')
35
+ create_driver('')
35
36
  }
36
37
  assert_raise(Fluent::ConfigError) {
37
- d = create_driver(%[
38
+ create_driver(%[
38
39
  ratio 1
39
40
  ])
40
41
  }
41
42
  assert_raise(Fluent::ConfigError) {
42
- d = create_driver(%[
43
+ create_driver(%[
43
44
  ratio 1
44
45
  key_names field1
45
46
  ])
46
47
  }
47
48
  assert_raise(Fluent::ConfigError) {
48
- d = create_driver(%[
49
+ create_driver(%[
49
50
  ratio 1
50
51
  add_prefix modified
51
52
  ])
52
53
  }
53
54
  assert_nothing_thrown {
54
- d = create_driver(%[
55
+ create_driver(%[
55
56
  ratio 1
56
57
  key_names field1
57
58
  add_prefix modified
58
59
  ])
59
60
  }
60
61
  assert_nothing_raised {
61
- d = create_driver(%[
62
+ create_driver(%[
62
63
  ratio 1
63
64
  key_pattern field\d+
64
65
  remove_prefix sampled
@@ -77,37 +78,37 @@ class AmplifierFilterOutputTest < Test::Unit::TestCase
77
78
  # remove_prefix test
78
79
  # add_prefix modified
79
80
  # ]
80
- d1 = create_driver(CONFIG, 'test.service')
81
- d1.run do
82
- d1.emit({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
83
- d1.emit({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
81
+ d1 = create_driver(CONFIG)
82
+ d1.run(default_tag: 'test.service') do
83
+ d1.feed({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
84
+ d1.feed({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
84
85
  end
85
- emits = d1.emits
86
- assert_equal 2, emits.length
87
- assert_equal 'modified.service', emits[0][0] # tag
86
+ events = d1.events
87
+ assert_equal 2, events.length
88
+ assert_equal 'modified.service', events[0][0] # tag
88
89
 
89
- first = emits[0][2]
90
+ first = events[0][2]
90
91
  assert_equal 'first', first['name']
91
92
  assert_equal 15 , first['foo']
92
93
  assert_equal 1.5 , first['bar']
93
94
  assert_equal 30 , first['baz']
94
95
  assert_equal 50 , first['zap']
95
96
 
96
- second = emits[1][2]
97
+ second = events[1][2]
97
98
  assert_equal 'second', second['name']
98
99
  assert_equal 15 , second['foo']
99
100
  assert_equal 3 , second['bar']
100
101
  assert_equal 60 , second['baz']
101
102
  assert_equal 50 , second['zap']
102
103
 
103
- d2 = create_driver(CONFIG, 'test')
104
- d2.run do
105
- d2.emit({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
106
- d2.emit({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
104
+ d2 = create_driver(CONFIG)
105
+ d2.run(default_tag: 'test') do
106
+ d2.feed({'name' => 'first', 'foo' => 10, 'bar' => 1, 'baz' => 20, 'zap' => 50})
107
+ d2.feed({'name' => 'second', 'foo' => 10, 'bar' => 2, 'baz' => 40, 'zap' => 50})
107
108
  end
108
- emits = d2.emits
109
- assert_equal 2, emits.length
110
- assert_equal 'modified', emits[0][0] # tag
109
+ events = d2.events
110
+ assert_equal 2, events.length
111
+ assert_equal 'modified', events[0][0] # tag
111
112
 
112
113
  # CONFIG2 = %[
113
114
  # ratio 0.75
@@ -115,23 +116,23 @@ class AmplifierFilterOutputTest < Test::Unit::TestCase
115
116
  # key_pattern field.*
116
117
  # remove_prefix test
117
118
  # ]
118
- d3 = create_driver(CONFIG2, 'test.service')
119
- d3.run do
120
- d3.emit({'name' => 'first', 'fieldfoo' => 10, 'fieldbar' => 1, 'fieldbaz' => 20, 'zap' => 50})
121
- d3.emit({'name' => 'second', 'fieldfoo' => '10', 'fieldbar' => '2', 'fieldbaz' => '40', 'zap' => '50'})
119
+ d3 = create_driver(CONFIG2)
120
+ d3.run(default_tag: 'test.service') do
121
+ d3.feed({'name' => 'first', 'fieldfoo' => 10, 'fieldbar' => 1, 'fieldbaz' => 20, 'zap' => 50})
122
+ d3.feed({'name' => 'second', 'fieldfoo' => '10', 'fieldbar' => '2', 'fieldbaz' => '40', 'zap' => '50'})
122
123
  end
123
- emits = d3.emits
124
- assert_equal 2, emits.length
125
- assert_equal 'service', emits[0][0] # tag
124
+ events = d3.events
125
+ assert_equal 2, events.length
126
+ assert_equal 'service', events[0][0] # tag
126
127
 
127
- first = emits[0][2]
128
+ first = events[0][2]
128
129
  assert_equal 'first', first['name']
129
130
  assert_equal 7 , first['fieldfoo']
130
131
  assert_equal 0 , first['fieldbar']
131
132
  assert_equal 15 , first['fieldbaz']
132
133
  assert_equal 50 , first['zap']
133
134
 
134
- second = emits[1][2]
135
+ second = events[1][2]
135
136
  assert_equal 'second', second['name']
136
137
  assert_equal 7 , second['fieldfoo']
137
138
  assert_equal 1 , second['fieldbar']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-amplifier-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.14.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
@@ -80,6 +80,7 @@ files:
80
80
  - README.md
81
81
  - Rakefile
82
82
  - fluent-plugin-amplifier-filter.gemspec
83
+ - lib/fluent/plugin/filter_amplifier.rb
83
84
  - lib/fluent/plugin/filter_amplifier_filter.rb
84
85
  - lib/fluent/plugin/out_amplifier_filter.rb
85
86
  - test/helper.rb