fluent-plugin-detect-exceptions-xiniaoyun 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +87 -0
- data/README.rdoc +3 -0
- data/{fluent-plugin-detect-exceptions.gemspec → fluent-plugin-detect-exceptions-xiniaoyun.gemspec} +4 -4
- data/lib/fluent/plugin/exception_detector.rb +4 -6
- data/lib/fluent/plugin/out_detect_exceptions.rb +5 -9
- data/test/plugin/test_exception_detector.rb +13 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67783b7c9d06f991adfedd7244368bf2c28300d012357062043e65cf43ccf24d
|
4
|
+
data.tar.gz: fdd107cc14cc23711ef9582589eb895dc4cc0196e2e0c18f36dd173da391e00d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fbd3b2611515e67a0a0ef1ce4baddddfdf829b107cc1af59f45ca410f07a43ebfc7ed9999bbfd1a2480e29574eebeef4ab46466a69ad3997954d5f637fc9fc1
|
7
|
+
data.tar.gz: 40e55ff0f11157bd5540b56a63e5b5c870854cc9437c0e700653c7b03e060b1ddb1f931c940c64baa19c9bd2de9213f7f1cc3ffb2672f0b7adf5bcfb9ae7a0cf
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-detect-exceptions-xiniaoyun (0.0.2)
|
5
|
+
fluentd (>= 0.10)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
cool.io (1.5.3-x86-mingw32)
|
12
|
+
dig_rb (1.0.1)
|
13
|
+
ffi (1.10.0-x86-mingw32)
|
14
|
+
ffi-win32-extensions (1.0.3)
|
15
|
+
ffi
|
16
|
+
flexmock (2.3.6)
|
17
|
+
fluentd (1.3.3-x86-mingw32)
|
18
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
19
|
+
dig_rb (~> 1.0.0)
|
20
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
21
|
+
msgpack (>= 0.7.0, < 2.0.0)
|
22
|
+
serverengine (>= 2.0.4, < 3.0.0)
|
23
|
+
sigdump (~> 0.2.2)
|
24
|
+
strptime (>= 0.2.2, < 1.0.0)
|
25
|
+
tzinfo (~> 1.0)
|
26
|
+
tzinfo-data (~> 1.0)
|
27
|
+
win32-event (~> 0.6.1)
|
28
|
+
win32-ipc (~> 0.6.1)
|
29
|
+
win32-service (~> 0.8.3)
|
30
|
+
windows-pr (~> 1.2.5)
|
31
|
+
yajl-ruby (~> 1.0)
|
32
|
+
http_parser.rb (0.6.0)
|
33
|
+
msgpack (1.2.6-x86-mingw32)
|
34
|
+
parser (2.6.0.0)
|
35
|
+
ast (~> 2.4.0)
|
36
|
+
power_assert (1.1.3)
|
37
|
+
powerpack (0.1.2)
|
38
|
+
rainbow (2.2.2)
|
39
|
+
rake
|
40
|
+
rake (10.5.0)
|
41
|
+
rubocop (0.42.0)
|
42
|
+
parser (>= 2.3.1.1, < 3.0)
|
43
|
+
powerpack (~> 0.1)
|
44
|
+
rainbow (>= 1.99.1, < 3.0)
|
45
|
+
ruby-progressbar (~> 1.7)
|
46
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
47
|
+
ruby-progressbar (1.10.0)
|
48
|
+
serverengine (2.1.0-x86-mingw32)
|
49
|
+
sigdump (~> 0.2.2)
|
50
|
+
windows-pr (~> 1.2.5)
|
51
|
+
sigdump (0.2.4)
|
52
|
+
strptime (0.2.3)
|
53
|
+
test-unit (3.3.0)
|
54
|
+
power_assert
|
55
|
+
thread_safe (0.3.6)
|
56
|
+
tzinfo (1.2.5)
|
57
|
+
thread_safe (~> 0.1)
|
58
|
+
tzinfo-data (1.2018.9)
|
59
|
+
tzinfo (>= 1.0.0)
|
60
|
+
unicode-display_width (1.4.1)
|
61
|
+
win32-api (1.8.0-universal-mingw32)
|
62
|
+
win32-event (0.6.3)
|
63
|
+
win32-ipc (>= 0.6.0)
|
64
|
+
win32-ipc (0.6.6)
|
65
|
+
ffi
|
66
|
+
win32-service (0.8.10)
|
67
|
+
ffi
|
68
|
+
ffi-win32-extensions
|
69
|
+
windows-api (0.4.4)
|
70
|
+
win32-api (>= 1.4.5)
|
71
|
+
windows-pr (1.2.6)
|
72
|
+
win32-api (>= 1.4.5)
|
73
|
+
windows-api (>= 0.4.0)
|
74
|
+
yajl-ruby (1.4.1)
|
75
|
+
|
76
|
+
PLATFORMS
|
77
|
+
x86-mingw32
|
78
|
+
|
79
|
+
DEPENDENCIES
|
80
|
+
flexmock (~> 2.0)
|
81
|
+
fluent-plugin-detect-exceptions-xiniaoyun!
|
82
|
+
rake (~> 10.3)
|
83
|
+
rubocop (= 0.42.0)
|
84
|
+
test-unit (~> 3.0)
|
85
|
+
|
86
|
+
BUNDLED WITH
|
87
|
+
2.0.1
|
data/README.rdoc
CHANGED
@@ -95,6 +95,9 @@ The plugin supports the following parameters:
|
|
95
95
|
This parameter is only applicable to structured (JSON) log streams.
|
96
96
|
Default: ''.
|
97
97
|
|
98
|
+
[join_separator] String used when joining multiple lines of the stack trace.
|
99
|
+
Default: ''.
|
100
|
+
|
98
101
|
Example configuration:
|
99
102
|
|
100
103
|
<match **>
|
data/{fluent-plugin-detect-exceptions.gemspec → fluent-plugin-detect-exceptions-xiniaoyun.gemspec}
RENAMED
@@ -9,11 +9,11 @@ eos
|
|
9
9
|
gem.summary = \
|
10
10
|
'fluentd output plugin for combining stack traces as multi-line JSON logs'
|
11
11
|
gem.homepage = \
|
12
|
-
'https://github.com/
|
12
|
+
'https://github.com/sunhao-java/fluent-plugin-detect-exceptions-xiniaoyun'
|
13
13
|
gem.license = 'Apache-2.0'
|
14
|
-
gem.version = '0.0.
|
15
|
-
gem.authors = ['
|
16
|
-
gem.email = ['
|
14
|
+
gem.version = '0.0.2'
|
15
|
+
gem.authors = ['SunHao']
|
16
|
+
gem.email = ['sunhao.java@gmail.com']
|
17
17
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
|
18
18
|
|
19
19
|
gem.files = Dir['**/*'].keep_if { |file| File.file?(file) }
|
@@ -237,10 +237,11 @@ module Fluent
|
|
237
237
|
# The named parameters max_lines and max_bytes limit the maximum amount
|
238
238
|
# of data to be buffered. The default value 0 indicates 'no limit'.
|
239
239
|
def initialize(message_field, languages, max_lines: 0, max_bytes: 0,
|
240
|
-
&emit_callback)
|
240
|
+
join_separator: '', &emit_callback)
|
241
241
|
@exception_detector = Fluent::ExceptionDetector.new(*languages)
|
242
242
|
@max_lines = max_lines
|
243
243
|
@max_bytes = max_bytes
|
244
|
+
@join_separator = join_separator
|
244
245
|
@message_field = message_field
|
245
246
|
@messages = []
|
246
247
|
@buffer_start_time = Time.now
|
@@ -273,10 +274,7 @@ module Fluent
|
|
273
274
|
when 1
|
274
275
|
@emit.call(@first_timestamp, @first_record)
|
275
276
|
else
|
276
|
-
combined_message = @messages.
|
277
|
-
memo << LINE_SEPARATOR unless memo.empty? || memo[-1].end_with?("\n")
|
278
|
-
memo << line
|
279
|
-
end.join
|
277
|
+
combined_message = @messages.join(@join_separator)
|
280
278
|
if @message_field.nil?
|
281
279
|
output_record = combined_message
|
282
280
|
else
|
@@ -336,7 +334,7 @@ module Fluent
|
|
336
334
|
|
337
335
|
def add(time_sec, record, message)
|
338
336
|
if @messages.empty?
|
339
|
-
@first_record = record
|
337
|
+
@first_record = record unless @message_field.nil?
|
340
338
|
@first_timestamp = time_sec
|
341
339
|
@buffer_start_time = Time.now
|
342
340
|
end
|
@@ -25,7 +25,7 @@ module Fluent
|
|
25
25
|
desc 'The field which contains the raw message text in the input JSON data.'
|
26
26
|
config_param :message, :string, default: ''
|
27
27
|
desc 'The prefix to be removed from the input tag when outputting a record.'
|
28
|
-
config_param :remove_tag_prefix, :string
|
28
|
+
config_param :remove_tag_prefix, :string, default: ''
|
29
29
|
desc 'The interval of flushing the buffer for multiline format.'
|
30
30
|
config_param :multiline_flush_interval, :time, default: nil
|
31
31
|
desc 'Programming languages for which to detect exceptions. Default: all.'
|
@@ -36,12 +36,11 @@ module Fluent
|
|
36
36
|
config_param :max_bytes, :integer, default: 0
|
37
37
|
desc 'Separate log streams by this field in the input JSON data.'
|
38
38
|
config_param :stream, :string, default: ''
|
39
|
+
desc 'String used when joining multiple lines of the stack trace'
|
40
|
+
config_param :join_separator, :string, default: ''
|
39
41
|
|
40
42
|
Fluent::Plugin.register_output('detect_exceptions', self)
|
41
43
|
|
42
|
-
ERROR_EMPTY_REMOVE_TAG_PREFIX =
|
43
|
-
'remove_tag_prefix must not be empty.'.freeze
|
44
|
-
|
45
44
|
def configure(conf)
|
46
45
|
super
|
47
46
|
|
@@ -49,10 +48,6 @@ module Fluent
|
|
49
48
|
@check_flush_interval = [multiline_flush_interval * 0.1, 1].max
|
50
49
|
end
|
51
50
|
|
52
|
-
if remove_tag_prefix.empty?
|
53
|
-
raise ConfigError, ERROR_EMPTY_REMOVE_TAG_PREFIX
|
54
|
-
end
|
55
|
-
|
56
51
|
@languages = languages.map(&:to_sym)
|
57
52
|
|
58
53
|
# Maps log stream tags to a corresponding TraceAccumulator.
|
@@ -100,7 +95,8 @@ module Fluent
|
|
100
95
|
@accumulators[log_id] =
|
101
96
|
Fluent::TraceAccumulator.new(@message, @languages,
|
102
97
|
max_lines: @max_lines,
|
103
|
-
max_bytes: @max_bytes
|
98
|
+
max_bytes: @max_bytes,
|
99
|
+
join_separator: @join_separator) do |t, r|
|
104
100
|
router.emit(out_tag, t, r)
|
105
101
|
end
|
106
102
|
end
|
@@ -765,4 +765,17 @@ END
|
|
765
765
|
# Check that the trace is flushed after the first part.
|
766
766
|
assert_equal([JAVA_EXC_PART1] + JAVA_EXC_PART2.lines, out)
|
767
767
|
end
|
768
|
+
|
769
|
+
def test_join_separator
|
770
|
+
# Custom join separator is used to join accumulated output
|
771
|
+
join_separator = ';'
|
772
|
+
out = []
|
773
|
+
buffer = Fluent::TraceAccumulator.new(nil,
|
774
|
+
[:all],
|
775
|
+
join_separator: join_separator) do |_, m|
|
776
|
+
out << m
|
777
|
+
end
|
778
|
+
feed_lines(buffer, JAVA_EXC)
|
779
|
+
assert_equal(JAVA_EXC.lines.length - 1, out[0].count(join_separator))
|
780
|
+
end
|
768
781
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-detect-exceptions-xiniaoyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- SunHao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -86,24 +86,25 @@ description: |2
|
|
86
86
|
same stack trace into one multi-line message.
|
87
87
|
This is an official Google Ruby gem.
|
88
88
|
email:
|
89
|
-
-
|
89
|
+
- sunhao.java@gmail.com
|
90
90
|
executables: []
|
91
91
|
extensions: []
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
94
|
- CONTRIBUTING
|
95
95
|
- Gemfile
|
96
|
+
- Gemfile.lock
|
96
97
|
- LICENSE
|
97
98
|
- README.rdoc
|
98
99
|
- Rakefile
|
99
|
-
- fluent-plugin-detect-exceptions.gemspec
|
100
|
+
- fluent-plugin-detect-exceptions-xiniaoyun.gemspec
|
100
101
|
- lib/fluent/plugin/exception_detector.rb
|
101
102
|
- lib/fluent/plugin/out_detect_exceptions.rb
|
102
103
|
- test/helper.rb
|
103
104
|
- test/plugin/bench_exception_detector.rb
|
104
105
|
- test/plugin/test_exception_detector.rb
|
105
106
|
- test/plugin/test_out_detect_exceptions.rb
|
106
|
-
homepage: https://github.com/
|
107
|
+
homepage: https://github.com/sunhao-java/fluent-plugin-detect-exceptions-xiniaoyun
|
107
108
|
licenses:
|
108
109
|
- Apache-2.0
|
109
110
|
metadata: {}
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.2
|
126
127
|
signing_key:
|
127
128
|
specification_version: 4
|
128
129
|
summary: fluentd output plugin for combining stack traces as multi-line JSON logs
|