fluentd 0.10.61 → 0.10.62

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40111b5009cbd336262c568c0cbe69bb3e34b42
4
- data.tar.gz: ad517f5db8a4b674e6b7b73ff731f8ad2a6a451c
3
+ metadata.gz: cd3088d98e7106ccaf044045d71999404e1357c5
4
+ data.tar.gz: f232ac836fea58e4719174883df438e2be8c9202
5
5
  SHA512:
6
- metadata.gz: cac0ecda9b4b25e13f05f1c4c65b68e32cec4fd0971296169207b546a0d498cbca3d28322bef27c77f5ddd29f8c041fb7ea7095e014e439feb2c17efbb995ade
7
- data.tar.gz: f2e6719f05fad72dd193433a716caee375a1f07077b22907a17d3dd41ff0b79427f6e2aa0768e4df945298f2316fcc5ec153dd86f708b430e3969f5362510659
6
+ metadata.gz: 55e3054d9f035d210a8c40dca48dd0067749b3d942e8bc6bed63425d8898c11146cca21491d7a32aa614a2d4270dd8ad2f8c7b2e23a06f65ebc0d98b12b53a2e
7
+ data.tar.gz: eb6293c1d478b3b384badba7024fe68d319797e37c6bebbc12dc7f1cbb89153776cd512b21b9f6ba7f449072906cadbe8907e244be0b76b37eb5bd56e5e1026a
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Release 0.10.62 - 2016/12/15
2
+
3
+ * Fix gem dependency to fix broken installation
4
+
1
5
  Release 0.10.61 - 2015/03/03
2
6
 
3
7
  * out_forward: Should handle ECONNREFUSED exeception on TCP heartbeat
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_runtime_dependency("msgpack", [">= 0.4.4", "!= 0.5.0", "!= 0.5.1", "!= 0.5.2", "!= 0.5.3", "!= 0.5.4",
22
22
  "!= 0.5.5", "!= 0.5.6", "!= 0.5.7", "!= 0.5.8", "!= 0.5.9", "!= 0.5.10", "< 0.6.0"])
23
- gem.add_runtime_dependency("json", [">= 1.4.3"])
23
+ gem.add_runtime_dependency("json", [">= 1.4.3", "< 2.0.0"])
24
24
  gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
25
25
  gem.add_runtime_dependency("cool.io", [">= 1.1.1", "!= 1.2.0", "< 2.0.0"])
26
26
  gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.7.0"])
@@ -29,10 +29,10 @@ Gem::Specification.new do |gem|
29
29
  gem.add_runtime_dependency("tzinfo-data", [">= 1.0.0"])
30
30
 
31
31
  gem.add_development_dependency("rake", [">= 0.9.2"])
32
- gem.add_development_dependency("flexmock")
33
- gem.add_development_dependency("parallel_tests", [">= 0.15.3"])
32
+ gem.add_development_dependency("flexmock", ["< 2.0.0"])
33
+ gem.add_development_dependency("parallel_tests", [">= 0.15.3", "< 2.0.0"])
34
34
  gem.add_development_dependency("simplecov", ["~> 0.6.4"])
35
- gem.add_development_dependency("rr", [">= 1.0.0"])
35
+ gem.add_development_dependency("rr", ["~> 1.1.2"])
36
36
  gem.add_development_dependency("timecop", [">= 0.3.0"])
37
37
  gem.add_development_dependency("test-unit", ["~> 3.0.2"])
38
38
  end
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Config
3
3
  class ConfigureProxy
4
- attr_accessor :name, :param_name, :required, :multi, :alias, :argument, :params, :defaults, :sections
4
+ attr_accessor :name, :final, :param_name, :required, :multi, :alias, :argument, :params, :defaults, :sections
5
5
  # config_param :desc, :string, :default => '....'
6
6
  # config_set_default :buffer_type, :memory
7
7
  #
@@ -22,6 +22,7 @@ module Fluent
22
22
 
23
23
  def initialize(name, opts = {})
24
24
  @name = name.to_sym
25
+ @final = opts.fetch(:final, false)
25
26
 
26
27
  @param_name = (opts[:param_name] || @name).to_sym
27
28
  @required = opts[:required]
@@ -42,7 +43,13 @@ module Fluent
42
43
  @multi.nil? ? true : @multi
43
44
  end
44
45
 
46
+ def final?
47
+ @final
48
+ end
49
+
45
50
  def merge(other) # self is base class, other is subclass
51
+ return merge_for_finalized(other) if self.final?
52
+
46
53
  options = {
47
54
  param_name: other.param_name,
48
55
  required: (other.required.nil? ? self.required : other.required),
@@ -53,7 +60,52 @@ module Fluent
53
60
  merged.argument = other.argument || self.argument
54
61
  merged.params = self.params.merge(other.params)
55
62
  merged.defaults = self.defaults.merge(other.defaults)
56
- merged.sections = self.sections.merge(other.sections)
63
+ merged.sections = {}
64
+ (self.sections.keys + other.sections.keys).uniq.each do |section_key|
65
+ self_section = self.sections[section_key]
66
+ other_section = other.sections[section_key]
67
+ merged_section = if self_section && other_section
68
+ self_section.merge(other_section)
69
+ elsif self_section || other_section
70
+ self_section || other_section
71
+ else
72
+ raise "BUG: both of self and other section are nil"
73
+ end
74
+ merged.sections[section_key] = merged_section
75
+ end
76
+
77
+ merged
78
+ end
79
+
80
+ def merge_for_finalized(other)
81
+ # list what subclass can do for finalized section
82
+ # * overwrite param_name to escape duplicated name of instance variable
83
+ # * append params/defaults/sections which are missing in superclass
84
+
85
+ options = {
86
+ param_name: other.param_name,
87
+ required: (self.required.nil? ? other.required : self.required),
88
+ multi: (self.multi.nil? ? other.multi : self.multi),
89
+ final: true,
90
+ }
91
+ merged = self.class.new(other.name, options)
92
+
93
+ merged.argument = self.argument || other.argument
94
+ merged.params = other.params.merge(self.params)
95
+ merged.defaults = other.defaults.merge(self.defaults)
96
+ merged.sections = {}
97
+ (self.sections.keys + other.sections.keys).uniq.each do |section_key|
98
+ self_section = self.sections[section_key]
99
+ other_section = other.sections[section_key]
100
+ merged_section = if self_section && other_section
101
+ other_section.merge(self_section)
102
+ elsif self_section || other_section
103
+ self_section || other_section
104
+ else
105
+ raise "BUG: both of self and other section are nil"
106
+ end
107
+ merged.sections[section_key] = merged_section
108
+ end
57
109
 
58
110
  merged
59
111
  end
@@ -146,7 +146,7 @@ module Fluent
146
146
 
147
147
  @ss.pos += code.length
148
148
 
149
- code
149
+ '"#{' + code + '}"'
150
150
  end
151
151
 
152
152
  def eval_embedded_code(code)
@@ -94,7 +94,7 @@ module Fluent
94
94
  def initialize(output)
95
95
  @output = output
96
96
  @finish = false
97
- @next_time = Engine.now + 1.0
97
+ @next_time = Time.now.to_f + 1.0
98
98
  end
99
99
 
100
100
  def configure(conf)
@@ -128,7 +128,7 @@ module Fluent
128
128
  @mutex.lock
129
129
  begin
130
130
  until @finish
131
- time = Engine.now
131
+ time = Time.now.to_f
132
132
 
133
133
  if @next_time <= time
134
134
  @mutex.unlock
@@ -137,7 +137,7 @@ module Fluent
137
137
  ensure
138
138
  @mutex.lock
139
139
  end
140
- next_wait = @next_time - Engine.now
140
+ next_wait = @next_time - Time.now.to_f
141
141
  else
142
142
  next_wait = @next_time - time
143
143
  end
@@ -226,7 +226,7 @@ module Fluent
226
226
  end
227
227
 
228
228
  def start
229
- @next_flush_time = Engine.now + @flush_interval
229
+ @next_flush_time = Time.now.to_f + @flush_interval
230
230
  @buffer.start
231
231
  @secondary.start if @secondary
232
232
  @writers.each {|writer| writer.start }
@@ -275,10 +275,10 @@ module Fluent
275
275
  end
276
276
 
277
277
  def try_flush
278
- time = Engine.now
278
+ time = Time.now.to_f
279
279
 
280
280
  empty = @buffer.queue_size == 0
281
- if empty && @next_flush_time < (now = Engine.now)
281
+ if empty && @next_flush_time < (now = Time.now.to_f)
282
282
  @buffer.synchronize do
283
283
  if @next_flush_time < now
284
284
  enqueue_buffer
@@ -325,7 +325,7 @@ module Fluent
325
325
  end
326
326
 
327
327
  if has_next
328
- return Engine.now + @queued_chunk_flush_interval
328
+ return Time.now.to_f + @queued_chunk_flush_interval
329
329
  else
330
330
  return time + @try_flush_interval
331
331
  end
@@ -380,7 +380,7 @@ module Fluent
380
380
 
381
381
  def force_flush
382
382
  @num_errors_lock.synchronize do
383
- @next_retry_time = Engine.now - 1
383
+ @next_retry_time = Time.now.to_f - 1
384
384
  end
385
385
  enqueue_buffer(true)
386
386
  submit_flush
@@ -27,6 +27,7 @@ module Fluent
27
27
 
28
28
  config_param :path, :string
29
29
  config_param :tag, :string
30
+ config_param :exclude_path, :array, :default => []
30
31
  config_param :rotate_wait, :time, :default => 5
31
32
  config_param :pos_file, :string, :default => nil
32
33
  config_param :read_from_head, :bool, :default => false
@@ -100,6 +101,8 @@ module Fluent
100
101
  def expand_paths
101
102
  date = Time.now
102
103
  paths = []
104
+
105
+ excluded = @exclude_path.map { |path| path = date.strftime(path); path.include?('*') ? Dir.glob(path) : path }.flatten.uniq
103
106
  @paths.each { |path|
104
107
  path = date.strftime(path)
105
108
  if path.include?('*')
@@ -109,7 +112,7 @@ module Fluent
109
112
  paths << path
110
113
  end
111
114
  }
112
- paths
115
+ paths - excluded
113
116
  end
114
117
 
115
118
  # in_tail with '*' path doesn't check rotation file equality at refresh phase.
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
 
3
- VERSION = '0.10.61'
3
+ VERSION = '0.10.62'
4
4
 
5
5
  end
@@ -100,14 +100,45 @@ module ConfigurableSpec
100
100
 
101
101
  config_param :name, :string, alias: :fullname
102
102
  config_param :bool, :bool, alias: :flag
103
- config_section :detail, required: true, multi: false, alias: "information" do
104
- config_param :address, :string
103
+ config_section :detail, required: false, multi: false, alias: "information" do
104
+ config_param :address, :string, default: "x"
105
105
  end
106
106
 
107
107
  def get_all
108
108
  [@name, @detail]
109
109
  end
110
110
  end
111
+
112
+ class Example2 < Example1
113
+ config_section :detail, required: true, multi: false, alias: "information2" do
114
+ config_param :address, :string, default: "y"
115
+ config_param :phone_no, :string
116
+ end
117
+ end
118
+
119
+ class Example3
120
+ include Fluent::Configurable
121
+
122
+ config_param :age, :integer, default: 10
123
+
124
+ config_section :appendix, required: true, multi: false, final: true do
125
+ config_param :type, :string
126
+ config_param :name, :string, default: "x"
127
+ end
128
+
129
+ def get_all
130
+ [@name, @detail]
131
+ end
132
+ end
133
+
134
+ class Example4 < Example3
135
+ config_param :age, :integer, default: 20
136
+
137
+ config_section :appendix, required: false, multi: false, final: false do
138
+ config_param :name, :string, default: "y"
139
+ config_param :age, :integer, default: 10
140
+ end
141
+ end
111
142
  end
112
143
 
113
144
  module Fluent::Config
@@ -493,6 +524,97 @@ module Fluent::Config
493
524
  assert_false(ex5.boolvalue)
494
525
  end
495
526
  end
527
+
528
+ sub_test_case '.config_section' do
529
+ def e(name, arg = '', attrs = {}, elements = [])
530
+ attrs_str_keys = {}
531
+ attrs.each{|key, value| attrs_str_keys[key.to_s] = value }
532
+ Fluent::Config::Element.new(name, arg, attrs_str_keys, elements)
533
+ end
534
+
535
+ test 'subclass configuration spec can overwrite superclass specs' do
536
+ # conf0 = e('ROOT', '', {}, [])
537
+
538
+ conf1 = e('ROOT', '', {
539
+ 'name' => 'tagomoris',
540
+ 'bool' => true,
541
+ },
542
+ )
543
+ # <detail> section is required by overwriting of Example2 config_section spec
544
+ assert_nothing_raised { ConfigurableSpec::Example1.new.configure(conf1) }
545
+ assert_raise(Fluent::ConfigError.new("'<detail>' sections are required")) { ConfigurableSpec::Example2.new.configure(conf1) }
546
+
547
+ conf2 = e('ROOT', '', {
548
+ 'name' => 'tagomoris',
549
+ 'bool' => true,
550
+ },
551
+ [e('detail', '', { 'phone_no' => "+81-00-0000-0000" }, [])],
552
+ )
553
+ # <detail> address </detail> default is overwritten by Example2
554
+ assert_nothing_raised { ConfigurableSpec::Example1.new.configure(conf2) }
555
+ assert_nothing_raised { ConfigurableSpec::Example2.new.configure(conf2) }
556
+ ex1 = ConfigurableSpec::Example1.new.configure(conf2)
557
+ assert_equal "x", ex1.detail.address
558
+ ex2 = ConfigurableSpec::Example2.new.configure(conf2)
559
+ assert_equal "y", ex2.detail.address
560
+
561
+ conf3 = e('ROOT', '', {
562
+ 'name' => 'tagomoris',
563
+ 'bool' => true,
564
+ },
565
+ [e('detail', '', { 'address' => "Chiyoda Tokyo Japan" }, [])],
566
+ )
567
+ # <detail> phone_no </detail> is required by Example2 config_param spec
568
+ assert_nothing_raised { ConfigurableSpec::Example1.new.configure(conf3) }
569
+ assert_raise(Fluent::ConfigError.new("'phone_no' parameter is required, in section detail")) { ConfigurableSpec::Example2.new.configure(conf3) }
570
+
571
+ conf4 = e('ROOT', '', {
572
+ 'name' => 'tagomoris',
573
+ 'bool' => true,
574
+ },
575
+ [e('detail', '', { 'address' => "Chiyoda Tokyo Japan", 'phone_no' => '+81-00-0000-0000' }, [])],
576
+ )
577
+ assert_nothing_raised { ConfigurableSpec::Example1.new.configure(conf4) } # phone_no is not used
578
+ assert_nothing_raised { ConfigurableSpec::Example2.new.configure(conf4) }
579
+
580
+ ex2 = ConfigurableSpec::Example2.new.configure(conf4)
581
+ assert_equal "Chiyoda Tokyo Japan", ex2.detail.address
582
+ assert_equal "+81-00-0000-0000", ex2.detail.phone_no
583
+ end
584
+
585
+ test 'adds only config_param definitions into configuration without overwriting existing finalized configuration elements' do
586
+
587
+ conf1 = e('ROOT', '', {}, [])
588
+ # <appendix> is required by Example3 and its not be overwritten by Example4
589
+ assert_raise(Fluent::ConfigError.new("'<appendix>' sections are required")) { ConfigurableSpec::Example3.new.configure(conf1) }
590
+ assert_raise(Fluent::ConfigError.new("'<appendix>' sections are required")) { ConfigurableSpec::Example4.new.configure(conf1) }
591
+
592
+ conf2 = e('ROOT', '', {
593
+ },
594
+ [e('appendix', '', {'type' => '1'}, [])],
595
+ )
596
+ # default value of age is overwritten by Example4, because root proxy is not finalized
597
+ ex3 = ConfigurableSpec::Example3.new.configure(conf2)
598
+ assert_equal 10, ex3.age
599
+ assert_equal '1', ex3.appendix.type
600
+ ex4 = ConfigurableSpec::Example4.new.configure(conf2)
601
+ assert_equal 20, ex4.age
602
+ assert_equal '1', ex4.appendix.type
603
+
604
+ conf3 = e('ROOT', '', {},
605
+ [e('appendix', '', {'type' => '2'}, [])],
606
+ )
607
+ # default value of <appendix> name </appendix> cannot be overwritten because it is finalized
608
+ ex3 = ConfigurableSpec::Example3.new.configure(conf2)
609
+ assert_equal 10, ex3.age
610
+ assert_equal '1', ex3.appendix.type
611
+ ex4 = ConfigurableSpec::Example4.new.configure(conf2)
612
+ assert_equal 20, ex4.age
613
+ assert_equal '1', ex4.appendix.type
614
+ # <appendix> age </appendix> can be added because it is missing in superclass spec
615
+ assert_equal 10, ex4.appendix.age
616
+ end
617
+ end
496
618
  end
497
619
 
498
620
  sub_test_case 'class defined with config_param/config_section having :alias' do
@@ -228,6 +228,8 @@ module Fluent::Config
228
228
  test('"#{"}"}"') { assert_text_parsed_as("}", '"#{"}"}"') }
229
229
  test('"#{#}"') { assert_parse_error('"#{#}"') } # error in embedded ruby code
230
230
  test("\"\#{\n=begin\n}\"") { assert_parse_error("\"\#{\n=begin\n}\"") } # error in embedded ruby code
231
+ test('"#{v1}foo#{v2}"') { assert_text_parsed_as("#{v1}foo#{v2}", '"#{v1}foo#{v2}"') }
232
+ test('"#{1+1}foo#{2+2}bar"') { assert_text_parsed_as("#{1+1}foo#{2+2}bar", '"#{1+1}foo#{2+2}bar"') }
231
233
  end
232
234
 
233
235
  sub_test_case 'array parsing' do
@@ -388,6 +388,11 @@ class TailInputTest < Test::Unit::TestCase
388
388
  timeclass.should_receive(:now).with_no_args.and_return(Time.new(2010, 1, 2, 3, 4, 5))
389
389
  assert_equal EX_PATHS, plugin.expand_paths.sort
390
390
  end
391
+
392
+ # Test exclusion
393
+ exclude_config = EX_CONFIG + " exclude_path [\"#{EX_PATHS.last}\"]"
394
+ plugin = create_driver(exclude_config, false).instance
395
+ assert_equal EX_PATHS - [EX_PATHS.last], plugin.expand_paths.sort
391
396
  end
392
397
 
393
398
  def test_refresh_watchers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.61
4
+ version: 0.10.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -103,6 +103,9 @@ dependencies:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: 1.4.3
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: 2.0.0
106
109
  type: :runtime
107
110
  prerelease: false
108
111
  version_requirements: !ruby/object:Gem::Requirement
@@ -110,6 +113,9 @@ dependencies:
110
113
  - - ">="
111
114
  - !ruby/object:Gem::Version
112
115
  version: 1.4.3
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: 2.0.0
113
119
  - !ruby/object:Gem::Dependency
114
120
  name: yajl-ruby
115
121
  requirement: !ruby/object:Gem::Requirement
@@ -230,16 +236,16 @@ dependencies:
230
236
  name: flexmock
231
237
  requirement: !ruby/object:Gem::Requirement
232
238
  requirements:
233
- - - ">="
239
+ - - "<"
234
240
  - !ruby/object:Gem::Version
235
- version: '0'
241
+ version: 2.0.0
236
242
  type: :development
237
243
  prerelease: false
238
244
  version_requirements: !ruby/object:Gem::Requirement
239
245
  requirements:
240
- - - ">="
246
+ - - "<"
241
247
  - !ruby/object:Gem::Version
242
- version: '0'
248
+ version: 2.0.0
243
249
  - !ruby/object:Gem::Dependency
244
250
  name: parallel_tests
245
251
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +253,9 @@ dependencies:
247
253
  - - ">="
248
254
  - !ruby/object:Gem::Version
249
255
  version: 0.15.3
256
+ - - "<"
257
+ - !ruby/object:Gem::Version
258
+ version: 2.0.0
250
259
  type: :development
251
260
  prerelease: false
252
261
  version_requirements: !ruby/object:Gem::Requirement
@@ -254,6 +263,9 @@ dependencies:
254
263
  - - ">="
255
264
  - !ruby/object:Gem::Version
256
265
  version: 0.15.3
266
+ - - "<"
267
+ - !ruby/object:Gem::Version
268
+ version: 2.0.0
257
269
  - !ruby/object:Gem::Dependency
258
270
  name: simplecov
259
271
  requirement: !ruby/object:Gem::Requirement
@@ -272,16 +284,16 @@ dependencies:
272
284
  name: rr
273
285
  requirement: !ruby/object:Gem::Requirement
274
286
  requirements:
275
- - - ">="
287
+ - - "~>"
276
288
  - !ruby/object:Gem::Version
277
- version: 1.0.0
289
+ version: 1.1.2
278
290
  type: :development
279
291
  prerelease: false
280
292
  version_requirements: !ruby/object:Gem::Requirement
281
293
  requirements:
282
- - - ">="
294
+ - - "~>"
283
295
  - !ruby/object:Gem::Version
284
- version: 1.0.0
296
+ version: 1.1.2
285
297
  - !ruby/object:Gem::Dependency
286
298
  name: timecop
287
299
  requirement: !ruby/object:Gem::Requirement
@@ -474,7 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
474
486
  version: '0'
475
487
  requirements: []
476
488
  rubyforge_project:
477
- rubygems_version: 2.2.2
489
+ rubygems_version: 2.5.1
478
490
  signing_key:
479
491
  specification_version: 4
480
492
  summary: Fluentd event collector