Skip to content

Commit

Permalink
Update ruby regex to support ruby 3.4 elastic#1509
Browse files Browse the repository at this point in the history
  • Loading branch information
gregawoods committed Dec 30, 2024
1 parent 5f6fc2b commit 0c50540
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/elastic_apm/stacktrace_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ElasticAPM
# @api private
class StacktraceBuilder
JAVA_FORMAT = /^(.+)\.([^.]+)\(([^:]+):(\d+)\)$/.freeze
RUBY_FORMAT = /^(.+?):(\d+)(?::in `(.+?)')?$/.freeze
RUBY_FORMAT = /^(.+?):(\d+)(?::in ['`](.+#)?(.+?)')?$/.freeze

RUBY_VERS_REGEX = %r{ruby(/gems)?[-/](\d+\.)+\d}.freeze
JRUBY_ORG_REGEX = %r{org/jruby}.freeze
Expand Down Expand Up @@ -77,9 +77,9 @@ def parse_line(line)
ruby_match = line.match(RUBY_FORMAT)

if ruby_match
_, file, number, method = ruby_match.to_a
_, file, number, module_name, method = ruby_match.to_a
file.sub!(/\.class$/, '.rb')
module_name = nil
module_name&.sub!('#', '')
else
java_match = line.match(JAVA_FORMAT)
_, module_name, method, file, number = java_match.to_a
Expand Down

0 comments on commit 0c50540

Please sign in to comment.