fluent-plugin-detect-exceptions 0.0.11 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +66 -0
- data/README.rdoc +10 -0
- data/fluent-plugin-detect-exceptions.gemspec +1 -1
- data/lib/fluent/plugin/exception_detector.rb +32 -10
- data/test/plugin/test_exception_detector.rb +82 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa3afee1139adec8fe98c8406bd72035d844aadf9f1715c01c5db3e45bd7e1c
|
4
|
+
data.tar.gz: 63b1bba51e317c9931d4904551b64ef94c56b0946bccec6f67edc2311c0bbba2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60bbd111f5818ebfa4eda68c87236c3d985df25e66acf12e29f2851f52c4f9e0c74a0d8bbeeb5f077f1b154c4f23fa2bb223ac26f230aff29fdc5d0ddfa69272
|
7
|
+
data.tar.gz: 85e20f53eb5e72b7062b6d60d724f55edc53997530dce6ca6adc252bb422a7c5466c73dc5370909ec944a52f7097a8d632649b2ed32fb16962689073dfe3415b
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-detect-exceptions (0.0.13)
|
5
|
+
fluentd (>= 0.10)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
concurrent-ruby (1.1.5)
|
12
|
+
cool.io (1.5.4)
|
13
|
+
dig_rb (1.0.1)
|
14
|
+
flexmock (2.3.6)
|
15
|
+
fluentd (1.7.4)
|
16
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
17
|
+
dig_rb (~> 1.0.0)
|
18
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
19
|
+
msgpack (>= 1.2.0, < 2.0.0)
|
20
|
+
serverengine (>= 2.0.4, < 3.0.0)
|
21
|
+
sigdump (~> 0.2.2)
|
22
|
+
strptime (>= 0.2.2, < 1.0.0)
|
23
|
+
tzinfo (~> 2.0)
|
24
|
+
tzinfo-data (~> 1.0)
|
25
|
+
yajl-ruby (~> 1.0)
|
26
|
+
http_parser.rb (0.6.0)
|
27
|
+
msgpack (1.3.1)
|
28
|
+
parser (2.6.5.0)
|
29
|
+
ast (~> 2.4.0)
|
30
|
+
power_assert (1.1.5)
|
31
|
+
powerpack (0.1.2)
|
32
|
+
rainbow (2.2.2)
|
33
|
+
rake
|
34
|
+
rake (10.5.0)
|
35
|
+
rubocop (0.42.0)
|
36
|
+
parser (>= 2.3.1.1, < 3.0)
|
37
|
+
powerpack (~> 0.1)
|
38
|
+
rainbow (>= 1.99.1, < 3.0)
|
39
|
+
ruby-progressbar (~> 1.7)
|
40
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
41
|
+
ruby-progressbar (1.10.1)
|
42
|
+
serverengine (2.1.1)
|
43
|
+
sigdump (~> 0.2.2)
|
44
|
+
sigdump (0.2.4)
|
45
|
+
strptime (0.2.3)
|
46
|
+
test-unit (3.3.4)
|
47
|
+
power_assert
|
48
|
+
tzinfo (2.0.0)
|
49
|
+
concurrent-ruby (~> 1.0)
|
50
|
+
tzinfo-data (1.2019.3)
|
51
|
+
tzinfo (>= 1.0.0)
|
52
|
+
unicode-display_width (1.6.0)
|
53
|
+
yajl-ruby (1.4.1)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
flexmock (~> 2.0)
|
60
|
+
fluent-plugin-detect-exceptions!
|
61
|
+
rake (~> 10.3)
|
62
|
+
rubocop (= 0.42.0)
|
63
|
+
test-unit (~> 3.0)
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
2.0.2
|
data/README.rdoc
CHANGED
@@ -98,12 +98,22 @@ The plugin supports the following parameters:
|
|
98
98
|
Example configuration:
|
99
99
|
|
100
100
|
<match **>
|
101
|
+
@type detect_exceptions
|
101
102
|
remove_tag_prefix foo
|
102
103
|
message log
|
103
104
|
languages java, python
|
104
105
|
multiline_flush_interval 0.1
|
105
106
|
</match>
|
106
107
|
|
108
|
+
== Extending language support
|
109
|
+
|
110
|
+
Supporting a new language requires new detection rules in this gem and
|
111
|
+
additional changes in the
|
112
|
+
{Stackdriver Error Reporting}[https://cloud.google.com/error-reporting/]
|
113
|
+
service. Please contact our product team by
|
114
|
+
{filing a support case}[https://cloud.google.com/support-hub/#google-cloud-platform]
|
115
|
+
if you'd like to see support for a new language.
|
116
|
+
|
107
117
|
== Copyright
|
108
118
|
|
109
119
|
Copyright:: Copyright 2016 Google Inc. All rights reserved.
|
@@ -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.13'
|
15
15
|
gem.authors = ['Stackdriver Agents']
|
16
16
|
gem.email = ['stackdriver-agents@google.com']
|
17
17
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
module Fluent
|
16
|
-
Struct.new('Rule', :
|
16
|
+
Struct.new('Rule', :from_states, :pattern, :to_state)
|
17
17
|
|
18
18
|
# Configuration of the state machine that detects exceptions.
|
19
19
|
module ExceptionDetectorConfig
|
@@ -41,8 +41,10 @@ module Fluent
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.rule(
|
45
|
-
|
44
|
+
def self.rule(from_state_or_states, pattern, to_state)
|
45
|
+
from_state_or_states = [from_state_or_states] unless
|
46
|
+
from_state_or_states.is_a?(Array)
|
47
|
+
Struct::Rule.new(from_state_or_states, pattern, to_state)
|
46
48
|
end
|
47
49
|
|
48
50
|
def self.supported
|
@@ -50,12 +52,29 @@ module Fluent
|
|
50
52
|
end
|
51
53
|
|
52
54
|
JAVA_RULES = [
|
53
|
-
rule(:start_state,
|
55
|
+
rule([:start_state, :java_start_exception],
|
54
56
|
/(?:Exception|Error|Throwable|V8 errors stack trace)[:\r\n]/,
|
57
|
+
:java_after_exception),
|
58
|
+
rule(:java_after_exception, /^[\t ]*nested exception is:[\t ]*/,
|
59
|
+
:java_start_exception),
|
60
|
+
rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception),
|
61
|
+
rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java),
|
62
|
+
|
63
|
+
rule([:java_after_exception, :java],
|
64
|
+
# C# nested exception.
|
65
|
+
/^[\t ]+--- End of inner exception stack trace ---$/,
|
55
66
|
:java),
|
56
|
-
|
57
|
-
rule(:
|
58
|
-
|
67
|
+
|
68
|
+
rule([:java_after_exception, :java],
|
69
|
+
# C# exception from async code.
|
70
|
+
/^--- End of stack trace from previous (?x:
|
71
|
+
)location where exception was thrown ---$/,
|
72
|
+
:java),
|
73
|
+
|
74
|
+
rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/,
|
75
|
+
:java_after_exception),
|
76
|
+
rule([:java_after_exception, :java],
|
77
|
+
/^[\t ]*... \d+ (?:more|common frames omitted)/, :java)
|
59
78
|
].freeze
|
60
79
|
|
61
80
|
PYTHON_RULES = [
|
@@ -76,13 +95,14 @@ module Fluent
|
|
76
95
|
|
77
96
|
GO_RULES = [
|
78
97
|
rule(:start_state, /\bpanic: /, :go_after_panic),
|
98
|
+
rule(:start_state, /http: panic serving/, :go_goroutine),
|
79
99
|
rule(:go_after_panic, /^$/, :go_goroutine),
|
100
|
+
rule([:go_after_panic, :go_after_signal, :go_frame_1],
|
101
|
+
/^$/, :go_goroutine),
|
80
102
|
rule(:go_after_panic, /^\[signal /, :go_after_signal),
|
81
|
-
rule(:go_after_signal, /^$/, :go_goroutine),
|
82
103
|
rule(:go_goroutine, /^goroutine \d+ \[[^\]]+\]:$/, :go_frame_1),
|
83
104
|
rule(:go_frame_1, /^(?:[^\s.:]+\.)*[^\s.():]+\(|^created by /,
|
84
105
|
:go_frame_2),
|
85
|
-
rule(:go_frame_1, /^$/, :go_goroutine),
|
86
106
|
rule(:go_frame_2, /^\s/, :go_frame_1)
|
87
107
|
].freeze
|
88
108
|
|
@@ -169,7 +189,9 @@ module Fluent
|
|
169
189
|
rule_config.each do |r|
|
170
190
|
target = ExceptionDetectorConfig::RuleTarget.new(r[:pattern],
|
171
191
|
r[:to_state])
|
172
|
-
|
192
|
+
r[:from_states].each do |from_state|
|
193
|
+
@rules[from_state] << target
|
194
|
+
end
|
173
195
|
end
|
174
196
|
end
|
175
197
|
|
@@ -59,7 +59,35 @@ Caused by: com.example.myproject.MyProjectServletException
|
|
59
59
|
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
|
60
60
|
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
|
61
61
|
at com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:30)
|
62
|
-
... 27
|
62
|
+
... 27 common frames omitted
|
63
|
+
END
|
64
|
+
|
65
|
+
NESTED_JAVA_EXC = <<END.freeze
|
66
|
+
java.lang.RuntimeException: javax.mail.SendFailedException: Invalid Addresses;
|
67
|
+
nested exception is:
|
68
|
+
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied
|
69
|
+
|
70
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:236)
|
71
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:285)
|
72
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.lambda$sendSingleEmail$3(AutomaticEmailFacade.java:254)
|
73
|
+
at java.util.Optional.ifPresent(Optional.java:159)
|
74
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:253)
|
75
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:249)
|
76
|
+
at com.nethunt.crm.api.email.EmailSender.lambda$notifyPerson$0(EmailSender.java:80)
|
77
|
+
at com.nethunt.crm.api.util.ManagedExecutor.lambda$execute$0(ManagedExecutor.java:36)
|
78
|
+
at com.nethunt.crm.api.util.RequestContextActivator.lambda$withRequestContext$0(RequestContextActivator.java:36)
|
79
|
+
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
|
80
|
+
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
|
81
|
+
at java.base/java.lang.Thread.run(Thread.java:748)
|
82
|
+
Caused by: javax.mail.SendFailedException: Invalid Addresses;
|
83
|
+
nested exception is:
|
84
|
+
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied
|
85
|
+
|
86
|
+
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:2064)
|
87
|
+
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1286)
|
88
|
+
at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:229)
|
89
|
+
... 12 more
|
90
|
+
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied
|
63
91
|
END
|
64
92
|
|
65
93
|
NODE_JS_EXC = <<END.freeze
|
@@ -214,6 +242,26 @@ created by main.main
|
|
214
242
|
server.go:20 +0x91
|
215
243
|
END
|
216
244
|
|
245
|
+
GO_HTTP = <<END.freeze
|
246
|
+
2019/01/15 07:48:05 http: panic serving [::1]:54143: test panic
|
247
|
+
goroutine 24 [running]:
|
248
|
+
net/http.(*conn).serve.func1(0xc00007eaa0)
|
249
|
+
/usr/local/go/src/net/http/server.go:1746 +0xd0
|
250
|
+
panic(0x12472a0, 0x12ece10)
|
251
|
+
/usr/local/go/src/runtime/panic.go:513 +0x1b9
|
252
|
+
main.doPanic(0x12f0ea0, 0xc00010e1c0, 0xc000104400)
|
253
|
+
/Users/ingvar/src/go/src/httppanic.go:8 +0x39
|
254
|
+
net/http.HandlerFunc.ServeHTTP(0x12be2e8, 0x12f0ea0, 0xc00010e1c0, 0xc000104400)
|
255
|
+
/usr/local/go/src/net/http/server.go:1964 +0x44
|
256
|
+
net/http.(*ServeMux).ServeHTTP(0x14a17a0, 0x12f0ea0, 0xc00010e1c0, 0xc000104400)
|
257
|
+
/usr/local/go/src/net/http/server.go:2361 +0x127
|
258
|
+
net/http.serverHandler.ServeHTTP(0xc000085040, 0x12f0ea0, 0xc00010e1c0, 0xc000104400)
|
259
|
+
/usr/local/go/src/net/http/server.go:2741 +0xab
|
260
|
+
net/http.(*conn).serve(0xc00007eaa0, 0x12f10a0, 0xc00008a780)
|
261
|
+
/usr/local/go/src/net/http/server.go:1847 +0x646
|
262
|
+
created by net/http.(*Server).Serve
|
263
|
+
/usr/local/go/src/net/http/server.go:2851 +0x2f5
|
264
|
+
END
|
217
265
|
CSHARP_EXC = <<END.freeze
|
218
266
|
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
|
219
267
|
at System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.Int32,System.Double]].get_Item (System.String key) [0x00000] in <filename unknown>:0
|
@@ -228,6 +276,33 @@ System.Collections.Generic.KeyNotFoundException: The given key was not present i
|
|
228
276
|
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
|
229
277
|
END
|
230
278
|
|
279
|
+
CSHARP_NESTED_EXC = <<END.freeze
|
280
|
+
System.InvalidOperationException: This is the outer exception ---> System.InvalidOperationException: This is the inner exception
|
281
|
+
at ExampleApp.NestedExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 33
|
282
|
+
at ExampleApp.NestedExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 28
|
283
|
+
at ExampleApp.NestedExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 18
|
284
|
+
--- End of inner exception stack trace ---
|
285
|
+
at ExampleApp.NestedExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 22
|
286
|
+
at ExampleApp.NestedExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 11
|
287
|
+
at ExampleApp.Program.Main(String[] args) in c:/ExampleApp/ExampleApp/Program.cs:line 11
|
288
|
+
END
|
289
|
+
|
290
|
+
CSHARP_ASYNC_EXC = <<END.freeze
|
291
|
+
System.InvalidOperationException: This is an exception
|
292
|
+
at ExampleApp2.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 36
|
293
|
+
at ExampleApp2.AsyncExceptionExample.<ThirdLevelMethod>d__2.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 31
|
294
|
+
--- End of stack trace from previous location where exception was thrown ---
|
295
|
+
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
|
296
|
+
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
|
297
|
+
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
|
298
|
+
at ExampleApp2.AsyncExceptionExample.<SecondLevelMethod>d__1.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 25
|
299
|
+
--- End of stack trace from previous location where exception was thrown ---
|
300
|
+
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
|
301
|
+
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
|
302
|
+
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
|
303
|
+
at ExampleApp2.AsyncExceptionExample.<TopLevelMethod>d__0.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 14
|
304
|
+
END
|
305
|
+
|
231
306
|
RUBY_EXC = <<END.freeze
|
232
307
|
NoMethodError (undefined method `resursivewordload' for #<BooksController:0x007f8dd9a0c738>):
|
233
308
|
app/controllers/books_controller.rb:69:in `recursivewordload'
|
@@ -531,6 +606,7 @@ END
|
|
531
606
|
def test_java
|
532
607
|
check_exception(JAVA_EXC, false)
|
533
608
|
check_exception(COMPLEX_JAVA_EXC, false)
|
609
|
+
check_exception(NESTED_JAVA_EXC, false)
|
534
610
|
end
|
535
611
|
|
536
612
|
def test_js
|
@@ -541,6 +617,8 @@ END
|
|
541
617
|
|
542
618
|
def test_csharp
|
543
619
|
check_exception(CSHARP_EXC, false)
|
620
|
+
check_exception(CSHARP_NESTED_EXC, false)
|
621
|
+
check_exception(CSHARP_ASYNC_EXC, false)
|
544
622
|
end
|
545
623
|
|
546
624
|
def test_python
|
@@ -556,6 +634,7 @@ END
|
|
556
634
|
check_exception(GO_EXC, false)
|
557
635
|
check_exception(GO_ON_GAE_EXC, false)
|
558
636
|
check_exception(GO_SIGNAL_EXC, false)
|
637
|
+
check_exception(GO_HTTP, false)
|
559
638
|
end
|
560
639
|
|
561
640
|
def test_ruby
|
@@ -598,6 +677,8 @@ END
|
|
598
677
|
check_exception(GO_ON_GAE_EXC, false)
|
599
678
|
check_exception(GO_SIGNAL_EXC, false)
|
600
679
|
check_exception(CSHARP_EXC, false)
|
680
|
+
check_exception(CSHARP_NESTED_EXC, false)
|
681
|
+
check_exception(CSHARP_ASYNC_EXC, false)
|
601
682
|
check_exception(V8_JS_EXC, false)
|
602
683
|
check_exception(RUBY_EXC, false)
|
603
684
|
check_exception(DART_ERR, false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stackdriver Agents
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -93,6 +93,7 @@ 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
|
@@ -122,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
|
-
|
126
|
-
rubygems_version: 2.7.6
|
126
|
+
rubygems_version: 3.0.4
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: fluentd output plugin for combining stack traces as multi-line JSON logs
|