From 9d5388ba207f35de6c13a86cca4fa2d4f96e4540 Mon Sep 17 00:00:00 2001 From: Jaroslav Kaspar Date: Fri, 16 Sep 2022 23:44:25 +0200 Subject: [PATCH] Add support for Go recovered panics --- lib/fluent/plugin/exception_detector.rb | 2 +- test/plugin/test_exception_detector.rb | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index d7c78b4..18a1a14 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -94,7 +94,7 @@ def self.supported ].freeze GO_RULES = [ - rule(:start_state, /\bpanic: /, :go_after_panic), + rule([:start_state, :go_after_panic], /\bpanic: /, :go_after_panic), rule(:start_state, /http: panic serving/, :go_goroutine), rule(:go_after_panic, /^$/, :go_goroutine), rule([:go_after_panic, :go_after_signal, :go_frame_1], diff --git a/test/plugin/test_exception_detector.rb b/test/plugin/test_exception_detector.rb index f001d0e..469866f 100644 --- a/test/plugin/test_exception_detector.rb +++ b/test/plugin/test_exception_detector.rb @@ -262,6 +262,30 @@ class ExceptionDetectorTest < Test::Unit::TestCase created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2851 +0x2f5 END + + GO_RECOVERED = <:0 @@ -635,6 +659,7 @@ def test_go check_exception(GO_ON_GAE_EXC, false) check_exception(GO_SIGNAL_EXC, false) check_exception(GO_HTTP, false) + check_exception(GO_RECOVERED, false) end def test_ruby