fluentd 1.6.3 → 1.7.1

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.

Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.drone.yml +35 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +2 -0
  4. data/CHANGELOG.md +83 -0
  5. data/README.md +5 -1
  6. data/fluentd.gemspec +3 -2
  7. data/lib/fluent/clock.rb +4 -0
  8. data/lib/fluent/compat/output.rb +3 -3
  9. data/lib/fluent/compat/socket_util.rb +1 -1
  10. data/lib/fluent/config/element.rb +3 -3
  11. data/lib/fluent/config/literal_parser.rb +1 -1
  12. data/lib/fluent/config/section.rb +4 -1
  13. data/lib/fluent/error.rb +4 -0
  14. data/lib/fluent/event.rb +28 -24
  15. data/lib/fluent/event_router.rb +2 -1
  16. data/lib/fluent/log.rb +1 -1
  17. data/lib/fluent/msgpack_factory.rb +8 -0
  18. data/lib/fluent/plugin/bare_output.rb +4 -4
  19. data/lib/fluent/plugin/buf_file.rb +10 -1
  20. data/lib/fluent/plugin/buf_file_single.rb +219 -0
  21. data/lib/fluent/plugin/buffer.rb +62 -63
  22. data/lib/fluent/plugin/buffer/chunk.rb +21 -3
  23. data/lib/fluent/plugin/buffer/file_chunk.rb +44 -12
  24. data/lib/fluent/plugin/buffer/file_single_chunk.rb +314 -0
  25. data/lib/fluent/plugin/buffer/memory_chunk.rb +2 -1
  26. data/lib/fluent/plugin/compressable.rb +10 -6
  27. data/lib/fluent/plugin/filter_grep.rb +2 -2
  28. data/lib/fluent/plugin/formatter_csv.rb +10 -6
  29. data/lib/fluent/plugin/in_syslog.rb +10 -3
  30. data/lib/fluent/plugin/in_tail.rb +7 -2
  31. data/lib/fluent/plugin/in_tcp.rb +34 -7
  32. data/lib/fluent/plugin/multi_output.rb +4 -4
  33. data/lib/fluent/plugin/out_exec_filter.rb +1 -0
  34. data/lib/fluent/plugin/out_file.rb +13 -3
  35. data/lib/fluent/plugin/out_forward.rb +144 -588
  36. data/lib/fluent/plugin/out_forward/ack_handler.rb +161 -0
  37. data/lib/fluent/plugin/out_forward/connection_manager.rb +113 -0
  38. data/lib/fluent/plugin/out_forward/error.rb +28 -0
  39. data/lib/fluent/plugin/out_forward/failure_detector.rb +84 -0
  40. data/lib/fluent/plugin/out_forward/handshake_protocol.rb +121 -0
  41. data/lib/fluent/plugin/out_forward/load_balancer.rb +111 -0
  42. data/lib/fluent/plugin/out_forward/socket_cache.rb +138 -0
  43. data/lib/fluent/plugin/out_http.rb +231 -0
  44. data/lib/fluent/plugin/output.rb +29 -35
  45. data/lib/fluent/plugin/parser.rb +77 -0
  46. data/lib/fluent/plugin/parser_csv.rb +75 -0
  47. data/lib/fluent/plugin/parser_syslog.rb +106 -3
  48. data/lib/fluent/plugin_helper/server.rb +2 -2
  49. data/lib/fluent/plugin_helper/socket.rb +14 -1
  50. data/lib/fluent/plugin_helper/thread.rb +1 -0
  51. data/lib/fluent/root_agent.rb +1 -1
  52. data/lib/fluent/time.rb +4 -2
  53. data/lib/fluent/timezone.rb +21 -7
  54. data/lib/fluent/version.rb +1 -1
  55. data/test/command/test_fluentd.rb +1 -1
  56. data/test/command/test_plugin_generator.rb +18 -2
  57. data/test/config/test_configurable.rb +78 -40
  58. data/test/counter/test_store.rb +1 -1
  59. data/test/helper.rb +1 -0
  60. data/test/helpers/process_extenstion.rb +33 -0
  61. data/test/plugin/out_forward/test_ack_handler.rb +101 -0
  62. data/test/plugin/out_forward/test_connection_manager.rb +145 -0
  63. data/test/plugin/out_forward/test_handshake_protocol.rb +103 -0
  64. data/test/plugin/out_forward/test_load_balancer.rb +60 -0
  65. data/test/plugin/out_forward/test_socket_cache.rb +139 -0
  66. data/test/plugin/test_buf_file.rb +172 -2
  67. data/test/plugin/test_buf_file_single.rb +801 -0
  68. data/test/plugin/test_buffer.rb +4 -48
  69. data/test/plugin/test_buffer_file_chunk.rb +38 -1
  70. data/test/plugin/test_buffer_file_single_chunk.rb +621 -0
  71. data/test/plugin/test_buffer_memory_chunk.rb +1 -0
  72. data/test/plugin/test_formatter_csv.rb +16 -0
  73. data/test/plugin/test_in_syslog.rb +56 -6
  74. data/test/plugin/test_in_tail.rb +1 -1
  75. data/test/plugin/test_in_tcp.rb +25 -0
  76. data/test/plugin/test_out_forward.rb +150 -201
  77. data/test/plugin/test_out_http.rb +352 -0
  78. data/test/plugin/test_output_as_buffered.rb +27 -24
  79. data/test/plugin/test_parser.rb +40 -0
  80. data/test/plugin/test_parser_csv.rb +83 -0
  81. data/test/plugin/test_parser_syslog.rb +118 -19
  82. data/test/plugin_helper/test_record_accessor.rb +1 -1
  83. data/test/test_time_formatter.rb +140 -121
  84. metadata +35 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf4c49c147ccaa5c7ad0c4585a4e2a0e156b525ff5eb0a4a163df1c20c1c8e1d
4
- data.tar.gz: 813578f6a63b400fadad9fead1b0edd323be8f92e31b1522133a886a28c9978b
3
+ metadata.gz: 5bb8d41e15ede72bfbb90c06171c0eb4aa77d479cda1a8320f60e6166fbc27fc
4
+ data.tar.gz: d781e152f408a74e1cfed6b2c37f593db814d551d9f9179d1c5d15581218bf43
5
5
  SHA512:
6
- metadata.gz: fbe1fbbe488245d3bda830a5ec3a0419e347ce7d6a685d5fd5f1d933c71382792cb047a45ffdbe982a763cdb336c1589958e9f84536c67452d1d608f9fea0db3
7
- data.tar.gz: d9d2370bf3ce08c0500aa99f83c16af9ef3ebb97b15e8992bf88a0b76834b1eaad82a1bab27d3f39b07be90cf20fdf8646d31ee401bdf98a6709b65496417c5d
6
+ metadata.gz: 1f04e656acafae78bf4e2a770a5df16d549aa59ecd0a5883e97884b1de2dccc612108b11a1302b0655a2d56e3fb0b5f077da345441f34ce94a6bc5d31b3fac61
7
+ data.tar.gz: d16a3635f5c9607de95f66f3b836c44786abd7db9a4bb369b51f41862df0279bc3812962c633fe8ac8ad9f4439fe22b8aaf18ff7aa099dafe531956c0a33985e
data/.drone.yml ADDED
@@ -0,0 +1,35 @@
1
+ kind: pipeline
2
+ name: fluentd-test-arm64-2-6-3
3
+
4
+ platform:
5
+ os: linux
6
+ arch: arm64
7
+
8
+ steps:
9
+ - name: fluentd-test-arm64-2-6-3
10
+ image: arm64v8/ruby:2.6.3
11
+ commands:
12
+ - apt update
13
+ - apt -y install libgmp3-dev
14
+ - export BUNDLE_GEMFILE=$PWD/Gemfile
15
+ - gem update --system
16
+ - bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
17
+ - bundle exec rake test
18
+ ---
19
+ kind: pipeline
20
+ name: fluentd-test-arm64-latest
21
+
22
+ platform:
23
+ os: linux
24
+ arch: arm64
25
+
26
+ steps:
27
+ - name: fluentd-test-arm64-latest
28
+ image: arm64v8/ruby:latest
29
+ commands:
30
+ - apt update
31
+ - apt -y install libgmp3-dev
32
+ - export BUNDLE_GEMFILE=$PWD/Gemfile
33
+ - gem update --system
34
+ - bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
35
+ - bundle exec rake test
@@ -22,6 +22,8 @@ Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CON
22
22
  - Operating system: `cat /etc/os-release`
23
23
  - Kernel version: `uname -r`
24
24
 
25
+ If you hit the problem with older fluentd version, try latest version first.
26
+
25
27
  **Your Configuration**
26
28
 
27
29
  ```
data/CHANGELOG.md CHANGED
@@ -1,3 +1,86 @@
1
+ # v1.7
2
+
3
+ ## Release v1.7.1 - 2019/09/08
4
+
5
+ ### Enhancement
6
+
7
+ * socket helper/out_forward: Support Windows certstore to load certificates
8
+ https://github.com/fluent/fluentd/pull/2601
9
+ * parser_syslog: Add faster parser for rfc3164 message
10
+ https://github.com/fluent/fluentd/pull/2599
11
+
12
+ ### Bug fixes
13
+
14
+ * buf_file/buf_file_single: fix to ignore placeholder based path.
15
+ https://github.com/fluent/fluentd/pull/2594
16
+ * server helper: Ignore ETIMEDOUT error in SSL_accept
17
+ https://github.com/fluent/fluentd/pull/2595
18
+ * buf_file: ensure to remove metadata after buffer creation failure
19
+ https://github.com/fluent/fluentd/pull/2598
20
+ * buf_file_single: fix duplicated path setting check
21
+ https://github.com/fluent/fluentd/pull/2600
22
+ * fix msgpack-ruby depedency to use recent feature
23
+ https://github.com/fluent/fluentd/pull/2606
24
+
25
+
26
+ ## Release v1.7.0 - 2019/08/20
27
+
28
+ ### New feature
29
+
30
+ * buffer: Add file_single buffer plugin
31
+ https://github.com/fluent/fluentd/pull/2579
32
+ * output: Add http output plugin
33
+ https://github.com/fluent/fluentd/pull/2488
34
+
35
+ ### Enhancement
36
+
37
+ * buffer: Improve the performance of buffer routine
38
+ https://github.com/fluent/fluentd/pull/2560
39
+ https://github.com/fluent/fluentd/pull/2563
40
+ https://github.com/fluent/fluentd/pull/2564
41
+ * output: Use Mutex instead of Monitor
42
+ https://github.com/fluent/fluentd/pull/2561
43
+ * event: Add `OneEventStrea#empty?` method
44
+ https://github.com/fluent/fluentd/pull/2565
45
+ * thread: Set thread name for ruby 2.3 or later
46
+ https://github.com/fluent/fluentd/pull/2574
47
+ * core: Cache msgpack packer/unpacker to avoid the object allocation
48
+ https://github.com/fluent/fluentd/pull/2559
49
+ * time: Use faster way to get sec and nsec
50
+ https://github.com/fluent/fluentd/pull/2557
51
+ * buf_file: Reduce IO flush by removing `IO#truncate`
52
+ https://github.com/fluent/fluentd/pull/2551
53
+ * in_tcp: Improve the performance for multiple event case
54
+ https://github.com/fluent/fluentd/pull/2567
55
+ * in_syslog: support `source_hostname_key` and `source_address_key` for unmatched event
56
+ https://github.com/fluent/fluentd/pull/2553
57
+ * formatter_csv: Improve the format performance.
58
+ https://github.com/fluent/fluentd/pull/2529
59
+ * parser_csv: Add fast parser for typical cases
60
+ https://github.com/fluent/fluentd/pull/2535
61
+ * out_forward: Refactor code
62
+ https://github.com/fluent/fluentd/pull/2516
63
+ https://github.com/fluent/fluentd/pull/2532
64
+
65
+ ### Bug fixes
66
+
67
+ * output: fix data lost on decompression
68
+ https://github.com/fluent/fluentd/pull/2547
69
+ * out_exec_filter: fix non-ascii encoding issue
70
+ https://github.com/fluent/fluentd/pull/2539
71
+ * in_tail: Don't call parser's configure twice
72
+ https://github.com/fluent/fluentd/pull/2569
73
+ * Fix unused message handling for <section> parameters
74
+ https://github.com/fluent/fluentd/pull/2578
75
+ * Fix comment/message typos
76
+ https://github.com/fluent/fluentd/pull/2549
77
+ https://github.com/fluent/fluentd/pull/2554
78
+ https://github.com/fluent/fluentd/pull/2556
79
+ https://github.com/fluent/fluentd/pull/2566
80
+ https://github.com/fluent/fluentd/pull/2573
81
+ https://github.com/fluent/fluentd/pull/2576
82
+ https://github.com/fluent/fluentd/pull/2583
83
+
1
84
  # v1.6
2
85
 
3
86
  ## Release v1.6.3 - 2019/07/29
data/README.md CHANGED
@@ -10,6 +10,10 @@ GitLab CI:
10
10
 
11
11
  [![pipeline status](https://gitlab.com/fluent/fluentd/badges/master/pipeline.svg)](https://gitlab.com/fluent/fluentd/commits/master)
12
12
 
13
+ Drone CI for Arm64:
14
+
15
+ [![pipeline status](https://cloud.drone.io/api/badges/fluent/fluentd/status.svg?branch=master)](https://cloud.drone.io/fluent/fluentd)
16
+
13
17
  [Fluentd](https://www.fluentd.org/) collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the [Unified Logging Layer](https://www.fluentd.org/blog/unified-logging-layer)).
14
18
 
15
19
  <p align="center">
@@ -78,7 +82,7 @@ You can run specified test via `TEST` environment variable:
78
82
  - Slack / Community: https://slack.fluentd.org
79
83
  - Newsletters: https://www.fluentd.org/newsletter
80
84
  - Author: [Sadayuki Furuhashi](https://github.com/frsyuki)
81
- - Copyright: 2011-2018 Fluentd Authors
85
+ - Copyright: 2011-2019 Fluentd Authors
82
86
  - License: Apache License, Version 2.0
83
87
 
84
88
  ## Contributors:
data/fluentd.gemspec CHANGED
@@ -18,13 +18,13 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 2.1'
20
20
 
21
- gem.add_runtime_dependency("msgpack", [">= 0.7.0", "< 2.0.0"])
21
+ gem.add_runtime_dependency("msgpack", [">= 1.2.0", "< 2.0.0"])
22
22
  gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
23
23
  gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
24
24
  gem.add_runtime_dependency("serverengine", [">= 2.0.4", "< 3.0.0"])
25
25
  gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.7.0"])
26
26
  gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
27
- gem.add_runtime_dependency("tzinfo", ["~> 1.0"])
27
+ gem.add_runtime_dependency("tzinfo", ["~> 2.0"])
28
28
  gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
29
29
  gem.add_runtime_dependency("strptime", [">= 0.2.2", "< 1.0.0"])
30
30
  gem.add_runtime_dependency("dig_rb", ["~> 1.0.0"])
@@ -37,6 +37,7 @@ Gem::Specification.new do |gem|
37
37
  gem.add_runtime_dependency("win32-ipc", ["~> 0.6.1"])
38
38
  gem.add_runtime_dependency("win32-event", ["~> 0.6.1"])
39
39
  gem.add_runtime_dependency("windows-pr", ["~> 1.2.5"])
40
+ gem.add_runtime_dependency("certstore_c", ["~> 0.1.2"])
40
41
  end
41
42
 
42
43
  gem.add_development_dependency("rake", ["~> 11.0"])
data/lib/fluent/clock.rb CHANGED
@@ -43,6 +43,10 @@ module Fluent
43
43
  Process.clock_gettime(CLOCK_ID)
44
44
  end
45
45
 
46
+ def self.real_now(unit = :second)
47
+ Process.clock_gettime(Process::CLOCK_REALTIME, unit)
48
+ end
49
+
46
50
  def self.dst_clock_from_time(time)
47
51
  diff_sec = Time.now - time
48
52
  now_raw - diff_sec
@@ -352,7 +352,7 @@ module Fluent
352
352
  write_guard do
353
353
  @buffer.write({meta => data}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
354
354
  end
355
- @counters_monitor.synchronize{ @emit_records += size }
355
+ @counter_mutex.synchronize{ @emit_records += size }
356
356
  return [meta]
357
357
  end
358
358
 
@@ -363,7 +363,7 @@ module Fluent
363
363
  write_guard do
364
364
  @buffer.write({meta => bulk}, format: ->(_data){ _data }, size: ->(){ size }, enqueue: enqueue)
365
365
  end
366
- @counters_monitor.synchronize{ @emit_records += size }
366
+ @counter_mutex.synchronize{ @emit_records += size }
367
367
  return [meta]
368
368
  end
369
369
 
@@ -373,7 +373,7 @@ module Fluent
373
373
  write_guard do
374
374
  @buffer.write({meta => data}, enqueue: enqueue)
375
375
  end
376
- @counters_monitor.synchronize{ @emit_records += size }
376
+ @counter_mutex.synchronize{ @emit_records += size }
377
377
  [meta]
378
378
  end
379
379
 
@@ -52,7 +52,7 @@ module Fluent
52
52
  end
53
53
 
54
54
  class TcpHandler < Coolio::Socket
55
- PEERADDR_FAILED = ["?", "?", "name resolusion failed", "?"]
55
+ PEERADDR_FAILED = ["?", "?", "name resolution failed", "?"]
56
56
 
57
57
  def initialize(io, log, delimiter, callback)
58
58
  super(io)
@@ -31,7 +31,7 @@ module Fluent
31
31
  @unused = unused || attrs.keys
32
32
  @v1_config = false
33
33
  @corresponding_proxies = [] # some plugins use flat parameters, e.g. in_http doesn't provide <format> section for parser.
34
- @unused_in = false # if this element is not used in plugins, correspoing plugin name and parent element name is set, e.g. [source, plugin class].
34
+ @unused_in = nil # if this element is not used in plugins, correspoing plugin name and parent element name is set, e.g. [source, plugin class].
35
35
 
36
36
  # it's global logger, not plugin logger: deprecated message should be global warning, not plugin level.
37
37
  @logger = defined?($log) ? $log : nil
@@ -110,13 +110,13 @@ module Fluent
110
110
  end
111
111
 
112
112
  def has_key?(key)
113
- @unused_in = false # some sections, e.g. <store> in copy, is not defined by config_section so clear unused flag for better warning message in check_not_fetched.
113
+ @unused_in = [] # some sections, e.g. <store> in copy, is not defined by config_section so clear unused flag for better warning message in check_not_fetched.
114
114
  @unused.delete(key)
115
115
  super
116
116
  end
117
117
 
118
118
  def [](key)
119
- @unused_in = false # ditto
119
+ @unused_in = [] # ditto
120
120
  @unused.delete(key)
121
121
 
122
122
  if RESERVED_PARAMETERS.include?(key) && !has_key?(key) && has_key?(RESERVED_PARAMETERS_COMPAT[key])
@@ -112,7 +112,7 @@ module Fluent
112
112
  elsif s = scan(/./)
113
113
  string << s
114
114
  else
115
- parse_error! "unexpected end of file in a signle quoted string"
115
+ parse_error! "unexpected end of file in a single quoted string"
116
116
  end
117
117
  end
118
118
  end
@@ -207,8 +207,11 @@ module Fluent
207
207
  elems = conf.respond_to?(:elements) ? conf.elements : []
208
208
  elems.each { |e|
209
209
  next if plugin_class.nil? && Fluent::Config::V1Parser::ELEM_SYMBOLS.include?(e.name) # skip pre-defined non-plugin elements because it doens't have proxy section
210
+ next if e.unused_in && e.unused_in.empty? # the section is used at least once
210
211
 
211
- unless proxy.sections.any? { |name, subproxy| e.name == subproxy.name.to_s || e.name == subproxy.alias.to_s }
212
+ if proxy.sections.any? { |name, subproxy| e.name == subproxy.name.to_s || e.name == subproxy.alias.to_s }
213
+ e.unused_in = []
214
+ else
212
215
  parent_name = if conf.arg.empty?
213
216
  conf.name
214
217
  else
data/lib/fluent/error.rb CHANGED
@@ -27,4 +27,8 @@ module Fluent
27
27
 
28
28
  class InvalidRootDirectory < UnrecoverableError
29
29
  end
30
+
31
+ # For internal use
32
+ class UncatchableError < Exception
33
+ end
30
34
  end
data/lib/fluent/event.rb CHANGED
@@ -50,30 +50,30 @@ module Fluent
50
50
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
51
51
  end
52
52
 
53
- def each(&block)
53
+ def each(unapcker: nil, &block)
54
54
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
55
55
  end
56
56
 
57
- def to_msgpack_stream(time_int: false)
58
- return to_msgpack_stream_forced_integer if time_int
59
- out = msgpack_packer
57
+ def to_msgpack_stream(time_int: false, packer: nil)
58
+ return to_msgpack_stream_forced_integer(packer: packer) if time_int
59
+ out = packer || msgpack_packer
60
60
  each {|time,record|
61
61
  out.write([time,record])
62
62
  }
63
- out.to_s
63
+ out.full_pack
64
64
  end
65
65
 
66
- def to_compressed_msgpack_stream(time_int: false)
67
- packed = to_msgpack_stream(time_int: time_int)
66
+ def to_compressed_msgpack_stream(time_int: false, packer: nil)
67
+ packed = to_msgpack_stream(time_int: time_int, packer: packer)
68
68
  compress(packed)
69
69
  end
70
70
 
71
- def to_msgpack_stream_forced_integer
72
- out = msgpack_packer
71
+ def to_msgpack_stream_forced_integer(packer: nil)
72
+ out = packer || msgpack_packer
73
73
  each {|time,record|
74
74
  out.write([time.to_i,record])
75
75
  }
76
- out.to_s
76
+ out.full_pack
77
77
  end
78
78
  end
79
79
 
@@ -87,6 +87,10 @@ module Fluent
87
87
  OneEventStream.new(@time, @record.dup)
88
88
  end
89
89
 
90
+ def empty?
91
+ false
92
+ end
93
+
90
94
  def size
91
95
  1
92
96
  end
@@ -103,7 +107,7 @@ module Fluent
103
107
  end
104
108
  end
105
109
 
106
- def each(&block)
110
+ def each(unpacker: nil, &block)
107
111
  block.call(@time, @record)
108
112
  nil
109
113
  end
@@ -139,7 +143,7 @@ module Fluent
139
143
  ArrayEventStream.new(@entries.slice(index, num))
140
144
  end
141
145
 
142
- def each(&block)
146
+ def each(unpacker: nil, &block)
143
147
  @entries.each(&block)
144
148
  nil
145
149
  end
@@ -186,7 +190,7 @@ module Fluent
186
190
  MultiEventStream.new(@time_array.slice(index, num), @record_array.slice(index, num))
187
191
  end
188
192
 
189
- def each(&block)
193
+ def each(unpacker: nil, &block)
190
194
  time_array = @time_array
191
195
  record_array = @record_array
192
196
  for i in 0..time_array.length-1
@@ -230,11 +234,11 @@ module Fluent
230
234
  true
231
235
  end
232
236
 
233
- def ensure_unpacked!
237
+ def ensure_unpacked!(unpacker: nil)
234
238
  return if @unpacked_times && @unpacked_records
235
239
  @unpacked_times = []
236
240
  @unpacked_records = []
237
- msgpack_unpacker.feed_each(@data) do |time, record|
241
+ (unpacker || msgpack_unpacker).feed_each(@data) do |time, record|
238
242
  @unpacked_times << time
239
243
  @unpacked_records << record
240
244
  end
@@ -250,7 +254,7 @@ module Fluent
250
254
  MultiEventStream.new(@unpacked_times.slice(index, num), @unpacked_records.slice(index, num))
251
255
  end
252
256
 
253
- def each(&block)
257
+ def each(unpacker: nil, &block)
254
258
  if @unpacked_times
255
259
  @unpacked_times.each_with_index do |time, i|
256
260
  block.call(time, @unpacked_records[i])
@@ -258,7 +262,7 @@ module Fluent
258
262
  else
259
263
  @unpacked_times = []
260
264
  @unpacked_records = []
261
- msgpack_unpacker.feed_each(@data) do |time, record|
265
+ (unpacker || msgpack_unpacker).feed_each(@data) do |time, record|
262
266
  @unpacked_times << time
263
267
  @unpacked_records << record
264
268
  block.call(time, record)
@@ -268,7 +272,7 @@ module Fluent
268
272
  nil
269
273
  end
270
274
 
271
- def to_msgpack_stream(time_int: false)
275
+ def to_msgpack_stream(time_int: false, packer: nil)
272
276
  # time_int is always ignored because @data is always packed binary in this class
273
277
  @data
274
278
  end
@@ -286,17 +290,17 @@ module Fluent
286
290
  super
287
291
  end
288
292
 
289
- def ensure_unpacked!
293
+ def ensure_unpacked!(unpacker: nil)
290
294
  ensure_decompressed!
291
295
  super
292
296
  end
293
297
 
294
- def each(&block)
298
+ def each(unpacker: nil, &block)
295
299
  ensure_decompressed!
296
300
  super
297
301
  end
298
302
 
299
- def to_msgpack_stream(time_int: false)
303
+ def to_msgpack_stream(time_int: false, packer: nil)
300
304
  ensure_decompressed!
301
305
  super
302
306
  end
@@ -318,15 +322,15 @@ module Fluent
318
322
  include MessagePackFactory::Mixin
319
323
  # chunk.extend(ChunkEventStreamer)
320
324
  # => chunk.each{|time, record| ... }
321
- def each(&block)
325
+ def each(unpacker: nil, &block)
322
326
  open do |io|
323
- msgpack_unpacker(io).each(&block)
327
+ (unpacker || msgpack_unpacker(io)).each(&block)
324
328
  end
325
329
  nil
326
330
  end
327
331
  alias :msgpack_each :each
328
332
 
329
- def to_msgpack_stream(time_int: false)
333
+ def to_msgpack_stream(time_int: false, packer: nil)
330
334
  # time_int is always ignored because data is already packed and written in chunk
331
335
  read
332
336
  end