fluentd 1.6.3-x86-mingw32 → 1.7.0-x86-mingw32

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 (79) 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 +58 -0
  5. data/README.md +5 -1
  6. data/fluentd.gemspec +1 -1
  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_single.rb +211 -0
  20. data/lib/fluent/plugin/buffer.rb +62 -63
  21. data/lib/fluent/plugin/buffer/chunk.rb +21 -3
  22. data/lib/fluent/plugin/buffer/file_chunk.rb +37 -12
  23. data/lib/fluent/plugin/buffer/file_single_chunk.rb +314 -0
  24. data/lib/fluent/plugin/buffer/memory_chunk.rb +2 -1
  25. data/lib/fluent/plugin/compressable.rb +10 -6
  26. data/lib/fluent/plugin/filter_grep.rb +2 -2
  27. data/lib/fluent/plugin/formatter_csv.rb +10 -6
  28. data/lib/fluent/plugin/in_syslog.rb +10 -3
  29. data/lib/fluent/plugin/in_tail.rb +7 -2
  30. data/lib/fluent/plugin/in_tcp.rb +34 -7
  31. data/lib/fluent/plugin/multi_output.rb +4 -4
  32. data/lib/fluent/plugin/out_exec_filter.rb +1 -0
  33. data/lib/fluent/plugin/out_file.rb +13 -3
  34. data/lib/fluent/plugin/out_forward.rb +126 -588
  35. data/lib/fluent/plugin/out_forward/ack_handler.rb +161 -0
  36. data/lib/fluent/plugin/out_forward/connection_manager.rb +113 -0
  37. data/lib/fluent/plugin/out_forward/error.rb +28 -0
  38. data/lib/fluent/plugin/out_forward/failure_detector.rb +84 -0
  39. data/lib/fluent/plugin/out_forward/handshake_protocol.rb +121 -0
  40. data/lib/fluent/plugin/out_forward/load_balancer.rb +111 -0
  41. data/lib/fluent/plugin/out_forward/socket_cache.rb +138 -0
  42. data/lib/fluent/plugin/out_http.rb +231 -0
  43. data/lib/fluent/plugin/output.rb +29 -35
  44. data/lib/fluent/plugin/parser.rb +77 -0
  45. data/lib/fluent/plugin/parser_csv.rb +75 -0
  46. data/lib/fluent/plugin_helper/server.rb +1 -1
  47. data/lib/fluent/plugin_helper/thread.rb +1 -0
  48. data/lib/fluent/root_agent.rb +1 -1
  49. data/lib/fluent/time.rb +4 -2
  50. data/lib/fluent/timezone.rb +21 -7
  51. data/lib/fluent/version.rb +1 -1
  52. data/test/command/test_fluentd.rb +1 -1
  53. data/test/command/test_plugin_generator.rb +18 -2
  54. data/test/config/test_configurable.rb +78 -40
  55. data/test/counter/test_store.rb +1 -1
  56. data/test/helper.rb +1 -0
  57. data/test/helpers/process_extenstion.rb +33 -0
  58. data/test/plugin/out_forward/test_ack_handler.rb +101 -0
  59. data/test/plugin/out_forward/test_connection_manager.rb +145 -0
  60. data/test/plugin/out_forward/test_handshake_protocol.rb +103 -0
  61. data/test/plugin/out_forward/test_load_balancer.rb +60 -0
  62. data/test/plugin/out_forward/test_socket_cache.rb +139 -0
  63. data/test/plugin/test_buf_file.rb +118 -2
  64. data/test/plugin/test_buf_file_single.rb +734 -0
  65. data/test/plugin/test_buffer.rb +4 -48
  66. data/test/plugin/test_buffer_file_chunk.rb +19 -1
  67. data/test/plugin/test_buffer_file_single_chunk.rb +620 -0
  68. data/test/plugin/test_formatter_csv.rb +16 -0
  69. data/test/plugin/test_in_syslog.rb +56 -6
  70. data/test/plugin/test_in_tail.rb +1 -1
  71. data/test/plugin/test_in_tcp.rb +25 -0
  72. data/test/plugin/test_out_forward.rb +75 -201
  73. data/test/plugin/test_out_http.rb +352 -0
  74. data/test/plugin/test_output_as_buffered.rb +27 -24
  75. data/test/plugin/test_parser.rb +40 -0
  76. data/test/plugin/test_parser_csv.rb +83 -0
  77. data/test/plugin_helper/test_record_accessor.rb +1 -1
  78. data/test/test_time_formatter.rb +140 -121
  79. metadata +33 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb2e03cd7a40b2276b0ef281ee57e27af4a16204b8da766d1a97c9ae145a1b02
4
- data.tar.gz: 91066de64539ac2a06fa97a730702ce41fb53ecab5818824c26630cacaa756e7
3
+ metadata.gz: 5b90cc36e403fd5085808b25ad55df73934177e67ea0451d8b2f9c8d3654826f
4
+ data.tar.gz: 1987375e47fbefce01117be8a01c21ffc19add05f0215114a394664e9a639f1d
5
5
  SHA512:
6
- metadata.gz: 7db0784aeb7136fbc9e6057855ff1c01235acfe4bea6b526d1ca82d01ce40e379a7be9c23534904ee14f036c18c5f3dbeb863bdd141742875b3494057f2a373d
7
- data.tar.gz: d1b838408dcc95821fe4cd8487690a1ea7e684157189d743d9e9f94dcfebe2d799b3321ecb3aeb05c08c87d2264a98377fb020af8f3b6d62f78323c5d6f90c03
6
+ metadata.gz: 4854391dcd5ab6b15df7ad2fecfed383c5e4a01be956a49d2d1dda7eaba43aa0032ad9fa50da9f06484102ac5be0bab83c3771cd0cda9526c8cb317b6304b892
7
+ data.tar.gz: 38bc9a17665bf0571e4f6c0fd404ac31545bba44427f6b3fa92cd5e116c7c397fca479775a1e71fe970fb3925bc0131d92125fcc070bba900944f3f3e4c68caa
@@ -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
  ```
@@ -1,3 +1,61 @@
1
+ # v1.7
2
+
3
+ ## Release v1.7.0 - 2019/08/20
4
+
5
+ ### New feature
6
+
7
+ * buffer: Add file_single buffer
8
+ https://github.com/fluent/fluentd/pull/2479
9
+
10
+ ### Enhancement
11
+
12
+ * buffer: Improve the performance of buffer routine
13
+ https://github.com/fluent/fluentd/pull/2560
14
+ https://github.com/fluent/fluentd/pull/2563
15
+ https://github.com/fluent/fluentd/pull/2564
16
+ * output: Use Mutext instead of Monitor
17
+ https://github.com/fluent/fluentd/pull/2561
18
+ * event: Add `OneEvent#empty?` method
19
+ https://github.com/fluent/fluentd/pull/2565
20
+ * thread: Set thread name for ruby 2.3 or later
21
+ https://github.com/fluent/fluentd/pull/2574
22
+ * core: Cache msgpack packer/unpacker to avoid the object allocation
23
+ https://github.com/fluent/fluentd/pull/2559
24
+ * time: Use faster way to get sec and nsec
25
+ https://github.com/fluent/fluentd/pull/2557
26
+ * buf_file: Reduce IO flush by removing `IO#truncate`
27
+ https://github.com/fluent/fluentd/pull/2551
28
+ * in_tcp: Improve the performance for multiple event case
29
+ https://github.com/fluent/fluentd/pull/2567
30
+ * in_syslog: support `source_hostname_key` and `source_address_key` for unmatched event
31
+ https://github.com/fluent/fluentd/pull/2553
32
+ * formatter_csv: Improve the format performance.
33
+ https://github.com/fluent/fluentd/pull/2529
34
+ * parser_csv: Add fast parser for typical cases
35
+ https://github.com/fluent/fluentd/pull/2535
36
+ * out_forward: Refactor code
37
+ https://github.com/fluent/fluentd/pull/2516
38
+ https://github.com/fluent/fluentd/pull/2532
39
+
40
+ ### Bug fixes
41
+
42
+ * output: fix data lost on decompression
43
+ https://github.com/fluent/fluentd/pull/2547
44
+ * out_exec_filter: fix non-ascii encoding issue
45
+ https://github.com/fluent/fluentd/pull/2539
46
+ * in_tail: Don't call parser's configure twice
47
+ https://github.com/fluent/fluentd/pull/2569
48
+ * Fix unused message handling for <section> parameters
49
+ https://github.com/fluent/fluentd/pull/2578
50
+ * Fix comment/message typos
51
+ https://github.com/fluent/fluentd/pull/2549
52
+ https://github.com/fluent/fluentd/pull/2554
53
+ https://github.com/fluent/fluentd/pull/2556
54
+ https://github.com/fluent/fluentd/pull/2566
55
+ https://github.com/fluent/fluentd/pull/2573
56
+ https://github.com/fluent/fluentd/pull/2576
57
+ https://github.com/fluent/fluentd/pull/2583
58
+
1
59
  # v1.6
2
60
 
3
61
  ## 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:
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
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"])
@@ -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
@@ -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
@@ -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
@@ -17,6 +17,7 @@
17
17
  require 'fluent/match'
18
18
  require 'fluent/event'
19
19
  require 'fluent/filter'
20
+ require 'fluent/msgpack_factory'
20
21
 
21
22
  module Fluent
22
23
  #
@@ -182,7 +183,7 @@ module Fluent
182
183
 
183
184
  def optimized_filter_stream(tag, es)
184
185
  new_es = MultiEventStream.new
185
- es.each do |time, record|
186
+ es.each(unpacker: Fluent::MessagePackFactory.thread_local_msgpack_unpacker) do |time, record|
186
187
  filtered_record = record
187
188
  filtered_time = time
188
189
 
@@ -606,7 +606,7 @@ module Fluent
606
606
  end
607
607
  end
608
608
 
609
- # This class delegetes some methods which are used in `Fluent::Logger` to a instance variable(`dev`) in `Logger::LogDevice` class
609
+ # This class delegates some methods which are used in `Fluent::Logger` to a instance variable(`dev`) in `Logger::LogDevice` class
610
610
  # https://github.com/ruby/ruby/blob/7b2d47132ff8ee950b0f978ab772dee868d9f1b0/lib/logger.rb#L661
611
611
  class LogDeviceIO < ::Logger::LogDevice
612
612
  def flush
@@ -58,5 +58,13 @@ module Fluent
58
58
  factory.register_type(Fluent::EventTime::TYPE, Fluent::EventTime)
59
59
  @@engine_factory = factory
60
60
  end
61
+
62
+ def self.thread_local_msgpack_packer
63
+ Thread.current[:local_msgpack_packer] ||= MessagePackFactory.engine_factory.packer
64
+ end
65
+
66
+ def self.thread_local_msgpack_unpacker
67
+ Thread.current[:local_msgpack_unpacker] ||= MessagePackFactory.engine_factory.unpacker
68
+ end
61
69
  end
62
70
  end