fluent-plugin-detect-exceptions 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4d82371017a4cc288bb5102634581367e87605
|
4
|
+
data.tar.gz: 408d49b121fba800e1a629f22fc1a33141effa9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e5493c81bf8dcf8feb7e7354e9dcef5d24e1cc7d2ead74d9280e2db5f67b73738e0ac9c5bf788ff4f6dbb12cb16532c7f47463f10eb2f9081a46f2205d4fe2
|
7
|
+
data.tar.gz: 6ab4f9257169fc87a9285e337051980ceebd1e6d3ffe4920d522cc4fcc00b2862dc18e7a361f86145e77468969e2ad1ac79411311609148d30e1445004e265d0
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-detect-exceptions (0.0.6)
|
5
|
+
fluentd (~> 0.10)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.3.0)
|
11
|
+
cool.io (1.5.0)
|
12
|
+
flexmock (2.3.5)
|
13
|
+
fluentd (0.14.17)
|
14
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
15
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
16
|
+
msgpack (>= 0.7.0, < 2.0.0)
|
17
|
+
serverengine (>= 2.0.4, < 3.0.0)
|
18
|
+
sigdump (~> 0.2.2)
|
19
|
+
strptime (~> 0.1.7)
|
20
|
+
tzinfo (~> 1.0)
|
21
|
+
tzinfo-data (~> 1.0)
|
22
|
+
yajl-ruby (~> 1.0)
|
23
|
+
http_parser.rb (0.6.0)
|
24
|
+
msgpack (1.1.0)
|
25
|
+
parser (2.4.0.0)
|
26
|
+
ast (~> 2.2)
|
27
|
+
power_assert (1.0.2)
|
28
|
+
powerpack (0.1.1)
|
29
|
+
rainbow (2.2.2)
|
30
|
+
rake
|
31
|
+
rake (10.5.0)
|
32
|
+
rubocop (0.42.0)
|
33
|
+
parser (>= 2.3.1.1, < 3.0)
|
34
|
+
powerpack (~> 0.1)
|
35
|
+
rainbow (>= 1.99.1, < 3.0)
|
36
|
+
ruby-progressbar (~> 1.7)
|
37
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
38
|
+
ruby-progressbar (1.8.1)
|
39
|
+
serverengine (2.0.5)
|
40
|
+
sigdump (~> 0.2.2)
|
41
|
+
sigdump (0.2.4)
|
42
|
+
strptime (0.1.9)
|
43
|
+
test-unit (3.2.4)
|
44
|
+
power_assert
|
45
|
+
thread_safe (0.3.6)
|
46
|
+
tzinfo (1.2.3)
|
47
|
+
thread_safe (~> 0.1)
|
48
|
+
tzinfo-data (1.2017.2)
|
49
|
+
tzinfo (>= 1.0.0)
|
50
|
+
unicode-display_width (1.2.1)
|
51
|
+
yajl-ruby (1.3.0)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
flexmock (~> 2.0)
|
58
|
+
fluent-plugin-detect-exceptions!
|
59
|
+
rake (~> 10.3)
|
60
|
+
rubocop (= 0.42.0)
|
61
|
+
test-unit (~> 3.0)
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
1.15.0
|
@@ -11,7 +11,7 @@ eos
|
|
11
11
|
gem.homepage = \
|
12
12
|
'https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions'
|
13
13
|
gem.license = 'Apache-2.0'
|
14
|
-
gem.version = '0.0.
|
14
|
+
gem.version = '0.0.7'
|
15
15
|
gem.authors = ['Thomas Schickinger', 'Igor Peshansky']
|
16
16
|
gem.email = ['schickin@google.com', 'igorp@google.com']
|
17
17
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
|
@@ -25,4 +25,5 @@ eos
|
|
25
25
|
gem.add_development_dependency 'rake', '~> 10.3'
|
26
26
|
gem.add_development_dependency 'rubocop', '= 0.42.0'
|
27
27
|
gem.add_development_dependency 'test-unit', '~> 3.0'
|
28
|
+
gem.add_development_dependency 'flexmock', '~> 2.0'
|
28
29
|
end
|
@@ -59,7 +59,7 @@ module Fluent
|
|
59
59
|
].freeze
|
60
60
|
|
61
61
|
PYTHON_RULES = [
|
62
|
-
rule(:start_state,
|
62
|
+
rule(:start_state, /^Traceback \(most recent call last\):$/, :python),
|
63
63
|
rule(:python, /^[\t ]+File /, :python_code),
|
64
64
|
rule(:python_code, /[^\t ]/, :python),
|
65
65
|
rule(:python, /^(?:[^\s.():]+\.)*[^\s.():]+:/, :start_state)
|
@@ -12,8 +12,10 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
require 'flexmock/test_unit'
|
15
16
|
require_relative '../helper'
|
16
17
|
require 'fluent/plugin/out_detect_exceptions'
|
18
|
+
require 'json'
|
17
19
|
|
18
20
|
class DetectExceptionsOutputTest < Test::Unit::TestCase
|
19
21
|
def setup
|
@@ -36,6 +38,14 @@ Caused by: org.AnotherException
|
|
36
38
|
at bar3
|
37
39
|
END
|
38
40
|
|
41
|
+
PHP_EXC = <<END.freeze
|
42
|
+
exception 'Exception' with message 'Custom exception' in /home/joe/work/test-php/test.php:5
|
43
|
+
Stack trace:
|
44
|
+
#0 /home/joe/work/test-php/test.php(9): func1()
|
45
|
+
#1 /home/joe/work/test-php/test.php(13): func2()
|
46
|
+
#2 {main}
|
47
|
+
END
|
48
|
+
|
39
49
|
PYTHON_EXC = <<END.freeze
|
40
50
|
Traceback (most recent call last):
|
41
51
|
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
|
@@ -43,6 +53,15 @@ Traceback (most recent call last):
|
|
43
53
|
Exception: ('spam', 'eggs')
|
44
54
|
END
|
45
55
|
|
56
|
+
RUBY_EXC = <<END.freeze
|
57
|
+
examble.rb:18:in `thrower': An error has occurred. (RuntimeError)
|
58
|
+
from examble.rb:14:in `caller'
|
59
|
+
from examble.rb:10:in `helper'
|
60
|
+
from examble.rb:6:in `writer'
|
61
|
+
from examble.rb:2:in `runner'
|
62
|
+
from examble.rb:21:in `<main>'
|
63
|
+
END
|
64
|
+
|
46
65
|
def create_driver(conf = CONFIG, tag = DEFAULT_TAG)
|
47
66
|
d = Fluent::Test::OutputTestDriver.new(Fluent::DetectExceptionsOutput, tag)
|
48
67
|
d.configure(conf)
|
@@ -98,6 +117,62 @@ END
|
|
98
117
|
assert_equal(make_logs(t, *messages), d.events)
|
99
118
|
end
|
100
119
|
|
120
|
+
def test_ignore_nested_exceptions
|
121
|
+
test_cases = {
|
122
|
+
'php' => PHP_EXC,
|
123
|
+
'python' => PYTHON_EXC,
|
124
|
+
'ruby' => RUBY_EXC
|
125
|
+
}
|
126
|
+
|
127
|
+
test_cases.each do |language, exception|
|
128
|
+
cfg = "languages #{language}"
|
129
|
+
d = create_driver(cfg)
|
130
|
+
t = Time.now.to_i
|
131
|
+
|
132
|
+
# Convert exception to a single line to simplify the test case.
|
133
|
+
single_line_exception = exception.gsub("\n", '\\n')
|
134
|
+
|
135
|
+
# There is a nested exception within the body, we should ignore those!
|
136
|
+
json_line_with_exception = {
|
137
|
+
'timestamp' => {
|
138
|
+
'nanos' => 998_152_494,
|
139
|
+
'seconds' => 1_496_420_064
|
140
|
+
},
|
141
|
+
'message' => single_line_exception,
|
142
|
+
'thread' => 139_658_267_147_048,
|
143
|
+
'severity' => 'ERROR'
|
144
|
+
}.to_json + "\n"
|
145
|
+
json_line_without_exception = {
|
146
|
+
'timestamp' => {
|
147
|
+
'nanos' => 5_990_266,
|
148
|
+
'seconds' => 1_496_420_065
|
149
|
+
},
|
150
|
+
'message' => 'next line',
|
151
|
+
'thread' => 139_658_267_147_048,
|
152
|
+
'severity' => 'INFO'
|
153
|
+
}.to_json + "\n"
|
154
|
+
|
155
|
+
router_mock = flexmock('router')
|
156
|
+
|
157
|
+
# Validate that each line received is emitted separately as expected.
|
158
|
+
router_mock.should_receive(:emit)
|
159
|
+
.once.with(DEFAULT_TAG, Integer,
|
160
|
+
'message' => json_line_with_exception,
|
161
|
+
'count' => 0)
|
162
|
+
|
163
|
+
router_mock.should_receive(:emit)
|
164
|
+
.once.with(DEFAULT_TAG, Integer,
|
165
|
+
'message' => json_line_without_exception,
|
166
|
+
'count' => 1)
|
167
|
+
|
168
|
+
d.instance.router = router_mock
|
169
|
+
|
170
|
+
d.run do
|
171
|
+
feed_lines(d, t, json_line_with_exception + json_line_without_exception)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
101
176
|
def test_single_language_config
|
102
177
|
cfg = 'languages java'
|
103
178
|
d = create_driver(cfg)
|
@@ -183,7 +258,7 @@ END
|
|
183
258
|
# exception. Then the rest is logged line-by-line.
|
184
259
|
expected = [PYTHON_EXC.lines[0..1].join] + PYTHON_EXC.lines[2..-1] + \
|
185
260
|
[JAVA_EXC.lines[0..1].join] + [JAVA_EXC.lines[2..3].join] + \
|
186
|
-
JAVA_EXC.lines[4
|
261
|
+
JAVA_EXC.lines[4..-1]
|
187
262
|
assert_equal(make_logs(t, *expected), d.events)
|
188
263
|
end
|
189
264
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-detect-exceptions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Schickinger
|
@@ -9,34 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0.10'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.10'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '10.3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '10.3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
@@ -57,16 +57,30 @@ dependencies:
|
|
57
57
|
name: test-unit
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '3.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: flexmock
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.0'
|
70
84
|
description: |2
|
71
85
|
Fluentd output plugin which detects exception stack traces in a stream of
|
72
86
|
JSON log messages and combines all single-line messages that belong to the
|
@@ -80,13 +94,14 @@ extensions: []
|
|
80
94
|
extra_rdoc_files: []
|
81
95
|
files:
|
82
96
|
- CONTRIBUTING
|
83
|
-
- fluent-plugin-detect-exceptions.gemspec
|
84
97
|
- Gemfile
|
85
|
-
-
|
86
|
-
- lib/fluent/plugin/out_detect_exceptions.rb
|
98
|
+
- Gemfile.lock
|
87
99
|
- LICENSE
|
88
|
-
- Rakefile
|
89
100
|
- README.rdoc
|
101
|
+
- Rakefile
|
102
|
+
- fluent-plugin-detect-exceptions.gemspec
|
103
|
+
- lib/fluent/plugin/exception_detector.rb
|
104
|
+
- lib/fluent/plugin/out_detect_exceptions.rb
|
90
105
|
- test/helper.rb
|
91
106
|
- test/plugin/bench_exception_detector.rb
|
92
107
|
- test/plugin/test_exception_detector.rb
|
@@ -101,17 +116,17 @@ require_paths:
|
|
101
116
|
- lib
|
102
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
118
|
requirements:
|
104
|
-
- -
|
119
|
+
- - ">="
|
105
120
|
- !ruby/object:Gem::Version
|
106
121
|
version: '2.0'
|
107
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
123
|
requirements:
|
109
|
-
- -
|
124
|
+
- - ">="
|
110
125
|
- !ruby/object:Gem::Version
|
111
126
|
version: '0'
|
112
127
|
requirements: []
|
113
128
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.6.12
|
115
130
|
signing_key:
|
116
131
|
specification_version: 4
|
117
132
|
summary: fluentd output plugin for combining stack traces as multi-line JSON logs
|