Skip to content

Commit 24bd438

Browse files
committed
Merge remote-tracking branch 'gregawoods/support-ruby-3.4' into pr-1510-and-1531
* gregawoods/support-ruby-3.4: Update changelog Fix failing mongo spec Add ruby version Update ruby regex to support ruby 3.4 elastic#1509
2 parents d681cfd + 90f4887 commit 24bd438

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.ci/.ruby.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
VERSION:
2+
- ruby:3.4
23
- ruby:3.1
34
- ruby:3.0
45
- ruby:2.7

lib/elastic_apm/stacktrace_builder.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module ElasticAPM
2424
# @api private
2525
class StacktraceBuilder
2626
JAVA_FORMAT = /^(.+)\.([^.]+)\(([^:]+):(\d+)\)$/.freeze
27-
RUBY_FORMAT = /^(.+?):(\d+)(?::in `(.+?)')?$/.freeze
27+
RUBY_FORMAT = /^(.+?):(\d+)(?::in ['`](.+#)?(.+?)')?$/.freeze
2828

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

7979
if ruby_match
80-
_, file, number, method = ruby_match.to_a
80+
_, file, number, module_name, method = ruby_match.to_a
8181
file.sub!(/\.class$/, '.rb')
82-
module_name = nil
82+
module_name&.sub!('#', '')
8383
else
8484
java_match = line.match(JAVA_FORMAT)
8585
_, module_name, method, file, number = java_match.to_a

spec/elastic_apm/spies/mongo_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module ElasticAPM
5252
expect(db.instance).to eq 'elastic-apm-test'
5353
expect(db.type).to eq 'mongodb'
5454
expect(db.statement).to eq('{"listCollections"=>1}')
55+
.or eq("{\"listCollections\" => 1}")
5556
expect(db.user).to be nil
5657

5758
destination = span.context.destination
@@ -102,6 +103,7 @@ module ElasticAPM
102103
expect(db.instance).to eq 'elastic-apm-test'
103104
expect(db.type).to eq 'mongodb'
104105
expect(db.statement).to eq('{"find"=>"testing", "filter"=>{"a"=>"bc"}}')
106+
.or eq("{\"find\" => \"testing\", \"filter\" => {\"a\" => \"bc\"}}")
105107
expect(db.user).to be nil
106108
end
107109
end

0 commit comments

Comments
 (0)