From 1c3db6005bfeb6289acfae1b6c47c4eec0284ac6 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Wed, 14 Dec 2016 15:44:13 +0200 Subject: [PATCH] backtrace: special case classloader path Fixes #139 (Found parsing error in my logs) --- CHANGELOG.md | 3 +++ lib/airbrake-ruby/backtrace.rb | 2 ++ spec/backtrace_spec.rb | 8 ++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f25d2f1..7dfe6ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Airbrake Ruby Changelog ### master +* Improved JRuby parsing of frames which include classloader + ([#140](https://github.com/airbrake/airbrake-ruby/pull/140)) + ### [v1.6.0][v1.6.0] (October 18, 2016) * Added support for blacklisting/whitelisting using procs diff --git a/lib/airbrake-ruby/backtrace.rb b/lib/airbrake-ruby/backtrace.rb index 7f88f655..5fbf31b7 100644 --- a/lib/airbrake-ruby/backtrace.rb +++ b/lib/airbrake-ruby/backtrace.rb @@ -32,6 +32,8 @@ module Patterns (? (?:uri:classloader:/.+(?=:)) # Matches '/META-INF/jruby.home/protocol.rb' | + (?:uri_3a_classloader_3a_.+(?=:)) # Matches 'uri_3a_classloader_3a_/gems/...' + | [^:]+ # Matches 'NewlineNode.java' ) :? diff --git a/spec/backtrace_spec.rb b/spec/backtrace_spec.rb index 4ea70032..f00b673d 100644 --- a/spec/backtrace_spec.rb +++ b/spec/backtrace_spec.rb @@ -80,14 +80,18 @@ let(:backtrace) do # rubocop:disable Metrics/LineLength ['uri_3a_classloader_3a_.META_minus_INF.jruby_dot_home.lib.ruby.stdlib.net.protocol.rbuf_fill(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/protocol.rb:158)', - 'bin.processors.image_uploader.block in make_streams(bin/processors/image_uploader.rb:21)'] + 'bin.processors.image_uploader.block in make_streams(bin/processors/image_uploader.rb:21)', + 'uri_3a_classloader_3a_.gems.faye_minus_websocket_minus_0_dot_10_dot_5.lib.faye.websocket.api.invokeOther13:dispatch_event(uri_3a_classloader_3a_/gems/faye_minus_websocket_minus_0_dot_10_dot_5/lib/faye/websocket/uri:classloader:/gems/faye-websocket-0.10.5/lib/faye/websocket/api.rb:109)', + 'tmp.jruby9022301782566983632extract.$dot.META_minus_INF.rails.file(/tmp/jruby9022301782566983632extract/./META-INF/rails.rb:13)'] # rubocop:enable Metrics/LineLength end let(:parsed_backtrace) do # rubocop:disable Metrics/LineLength [{ file: 'uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/protocol.rb', line: 158, function: 'uri_3a_classloader_3a_.META_minus_INF.jruby_dot_home.lib.ruby.stdlib.net.protocol.rbuf_fill' }, - { file: 'bin/processors/image_uploader.rb', line: 21, function: 'bin.processors.image_uploader.block in make_streams' }] + { file: 'bin/processors/image_uploader.rb', line: 21, function: 'bin.processors.image_uploader.block in make_streams' }, + { file: 'uri_3a_classloader_3a_/gems/faye_minus_websocket_minus_0_dot_10_dot_5/lib/faye/websocket/uri:classloader:/gems/faye-websocket-0.10.5/lib/faye/websocket/api.rb', line: 109, function: 'uri_3a_classloader_3a_.gems.faye_minus_websocket_minus_0_dot_10_dot_5.lib.faye.websocket.api.invokeOther13:dispatch_event' }, + { file: '/tmp/jruby9022301782566983632extract/./META-INF/rails.rb', line: 13, function: 'tmp.jruby9022301782566983632extract.$dot.META_minus_INF.rails.file' }] # rubocop:enable Metrics/LineLength end