fluentd 1.6.3 → 1.7.0
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 +4 -4
- data/.drone.yml +35 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +2 -0
- data/CHANGELOG.md +58 -0
- data/README.md +5 -1
- data/fluentd.gemspec +1 -1
- data/lib/fluent/clock.rb +4 -0
- data/lib/fluent/compat/output.rb +3 -3
- data/lib/fluent/compat/socket_util.rb +1 -1
- data/lib/fluent/config/element.rb +3 -3
- data/lib/fluent/config/literal_parser.rb +1 -1
- data/lib/fluent/config/section.rb +4 -1
- data/lib/fluent/error.rb +4 -0
- data/lib/fluent/event.rb +28 -24
- data/lib/fluent/event_router.rb +2 -1
- data/lib/fluent/log.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +8 -0
- data/lib/fluent/plugin/bare_output.rb +4 -4
- data/lib/fluent/plugin/buf_file_single.rb +211 -0
- data/lib/fluent/plugin/buffer.rb +62 -63
- data/lib/fluent/plugin/buffer/chunk.rb +21 -3
- data/lib/fluent/plugin/buffer/file_chunk.rb +37 -12
- data/lib/fluent/plugin/buffer/file_single_chunk.rb +314 -0
- data/lib/fluent/plugin/buffer/memory_chunk.rb +2 -1
- data/lib/fluent/plugin/compressable.rb +10 -6
- data/lib/fluent/plugin/filter_grep.rb +2 -2
- data/lib/fluent/plugin/formatter_csv.rb +10 -6
- data/lib/fluent/plugin/in_syslog.rb +10 -3
- data/lib/fluent/plugin/in_tail.rb +7 -2
- data/lib/fluent/plugin/in_tcp.rb +34 -7
- data/lib/fluent/plugin/multi_output.rb +4 -4
- data/lib/fluent/plugin/out_exec_filter.rb +1 -0
- data/lib/fluent/plugin/out_file.rb +13 -3
- data/lib/fluent/plugin/out_forward.rb +126 -588
- data/lib/fluent/plugin/out_forward/ack_handler.rb +161 -0
- data/lib/fluent/plugin/out_forward/connection_manager.rb +113 -0
- data/lib/fluent/plugin/out_forward/error.rb +28 -0
- data/lib/fluent/plugin/out_forward/failure_detector.rb +84 -0
- data/lib/fluent/plugin/out_forward/handshake_protocol.rb +121 -0
- data/lib/fluent/plugin/out_forward/load_balancer.rb +111 -0
- data/lib/fluent/plugin/out_forward/socket_cache.rb +138 -0
- data/lib/fluent/plugin/out_http.rb +231 -0
- data/lib/fluent/plugin/output.rb +29 -35
- data/lib/fluent/plugin/parser.rb +77 -0
- data/lib/fluent/plugin/parser_csv.rb +75 -0
- data/lib/fluent/plugin_helper/server.rb +1 -1
- data/lib/fluent/plugin_helper/thread.rb +1 -0
- data/lib/fluent/root_agent.rb +1 -1
- data/lib/fluent/time.rb +4 -2
- data/lib/fluent/timezone.rb +21 -7
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_fluentd.rb +1 -1
- data/test/command/test_plugin_generator.rb +18 -2
- data/test/config/test_configurable.rb +78 -40
- data/test/counter/test_store.rb +1 -1
- data/test/helper.rb +1 -0
- data/test/helpers/process_extenstion.rb +33 -0
- data/test/plugin/out_forward/test_ack_handler.rb +101 -0
- data/test/plugin/out_forward/test_connection_manager.rb +145 -0
- data/test/plugin/out_forward/test_handshake_protocol.rb +103 -0
- data/test/plugin/out_forward/test_load_balancer.rb +60 -0
- data/test/plugin/out_forward/test_socket_cache.rb +139 -0
- data/test/plugin/test_buf_file.rb +118 -2
- data/test/plugin/test_buf_file_single.rb +734 -0
- data/test/plugin/test_buffer.rb +4 -48
- data/test/plugin/test_buffer_file_chunk.rb +19 -1
- data/test/plugin/test_buffer_file_single_chunk.rb +620 -0
- data/test/plugin/test_formatter_csv.rb +16 -0
- data/test/plugin/test_in_syslog.rb +56 -6
- data/test/plugin/test_in_tail.rb +1 -1
- data/test/plugin/test_in_tcp.rb +25 -0
- data/test/plugin/test_out_forward.rb +75 -201
- data/test/plugin/test_out_http.rb +352 -0
- data/test/plugin/test_output_as_buffered.rb +27 -24
- data/test/plugin/test_parser.rb +40 -0
- data/test/plugin/test_parser_csv.rb +83 -0
- data/test/plugin_helper/test_record_accessor.rb +1 -1
- data/test/test_time_formatter.rb +140 -121
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa26c04f10203245130ee2457e56f1ea064df188d91c3610aa338f5f66273663
|
4
|
+
data.tar.gz: 48031fcf5dc26c8d1e3a6f6fc4a5f629451c6dc9a06c4a95043c3ba56da031b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac003c0a88bfd623a9e1caf2989db9e45b38841827dc312e4e266ff38cc1ac25001a58fda0fc5b7eebb9b4efa4bfc9cbf0266ad36314aa5ed518303040e09727
|
7
|
+
data.tar.gz: b84fb3fe1b06ee99fcdad4cbc37d897b507b5b916d5ad8b539863827e6d1875ca6c026ae54b6b05898750e84357db51583e59872ee76bc814e3bc7e29e2e3fc2
|
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,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-
|
85
|
+
- Copyright: 2011-2019 Fluentd Authors
|
82
86
|
- License: Apache License, Version 2.0
|
83
87
|
|
84
88
|
## Contributors:
|
data/fluentd.gemspec
CHANGED
@@ -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", ["~>
|
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"])
|
data/lib/fluent/clock.rb
CHANGED
data/lib/fluent/compat/output.rb
CHANGED
@@ -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
|
-
@
|
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
|
-
@
|
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
|
-
@
|
376
|
+
@counter_mutex.synchronize{ @emit_records += size }
|
377
377
|
[meta]
|
378
378
|
end
|
379
379
|
|
@@ -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 =
|
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 =
|
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 =
|
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])
|
@@ -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
|
-
|
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
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.
|
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.
|
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
|
data/lib/fluent/event_router.rb
CHANGED
@@ -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
|
|
data/lib/fluent/log.rb
CHANGED
@@ -606,7 +606,7 @@ module Fluent
|
|
606
606
|
end
|
607
607
|
end
|
608
608
|
|
609
|
-
# This 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
|