From 71cc0fa3d8670097d5881218293cdf8fdf298be8 Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Thu, 17 Oct 2019 09:58:33 +0200 Subject: [PATCH 1/3] simplify python rules --- lib/fluent/plugin/exception_detector.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 2d868bf..0ae4ae1 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -79,8 +79,7 @@ def self.supported PYTHON_RULES = [ rule(:start_state, /^Traceback \(most recent call last\):$/, :python), - rule(:python, /^[\t ]+File /, :python_code), - rule(:python_code, /[^\t ]/, :python), + rule(:python, /^[\t ]+[\S]+.*/, :python), rule(:python, /^(?:[^\s.():]+\.)*[^\s.():]+:/, :start_state) ].freeze From 55b143dd7b687dcabb722d0275825001322171e9 Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Thu, 17 Oct 2019 14:03:34 +0200 Subject: [PATCH 2/3] use second entrypoint instead of simplified rule This reverts commit 71cc0fa3d8670097d5881218293cdf8fdf298be8. --- lib/fluent/plugin/exception_detector.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 0ae4ae1..52ac28d 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -79,7 +79,8 @@ def self.supported PYTHON_RULES = [ rule(:start_state, /^Traceback \(most recent call last\):$/, :python), - rule(:python, /^[\t ]+[\S]+.*/, :python), + rule([:python, :python_code], /^[\t ]+File /, :python_code), + rule(:python_code, /[^\t ]/, :python), rule(:python, /^(?:[^\s.():]+\.)*[^\s.():]+:/, :start_state) ].freeze From 74b7b44da513280474fbcba2755a173ff30bd14b Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Thu, 24 Oct 2019 07:57:32 +0200 Subject: [PATCH 3/3] add test to detect two subsequent lines starting with ' File' --- test/plugin/test_exception_detector.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/plugin/test_exception_detector.rb b/test/plugin/test_exception_detector.rb index f001d0e..b2e77d1 100644 --- a/test/plugin/test_exception_detector.rb +++ b/test/plugin/test_exception_detector.rb @@ -132,6 +132,24 @@ class ExceptionDetectorTest < Test::Unit::TestCase File "/base/data/home/apps/s~nearfieldspy/1.378705245900539993/nearfieldspy.py", line 5, in get raise Exception('spam', 'eggs') Exception: ('spam', 'eggs') +END + + PYTHON_DOUBLE_FILE_EXC = <", line 1, in + File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 66, in operate + return o[0](self.expr, op, *(other + o[1:]), **kwargs) + File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/default_comparator.py", line 194, in _in_impl + for o in seq_or_selectable: +TypeError: 'NoneType' object is not iterable END PHP_EXC = <