Skip to content

Commit e17cf0f

Browse files
committed
fix: pass block argument in ActiveRecord find_by_sql patch
`find_by_sql` takes a block as its final argument, which is neither a positional nor a keyword argument, hence we need to pass it explicitly; before this commit, the block was not passed to the `super()` call and hence not executed, thus altering application behavior. Fixes #1258
1 parent bf6394d commit e17cf0f

File tree

1 file changed

+2
-2
lines changed
  • instrumentation/active_record/lib/opentelemetry/instrumentation/active_record/patches

1 file changed

+2
-2
lines changed

instrumentation/active_record/lib/opentelemetry/instrumentation/active_record/patches/querying.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class << base
2020
module ClassMethods
2121
method_name = ::ActiveRecord.version >= Gem::Version.new('7.0.0') ? :_query_by_sql : :find_by_sql
2222

23-
define_method(method_name) do |*args, **kwargs|
23+
define_method(method_name) do |*args, **kwargs, &block|
2424
tracer.in_span("#{self} query") do
25-
super(*args, **kwargs)
25+
super(*args, **kwargs, &block)
2626
end
2727
end
2828

0 commit comments

Comments
 (0)