We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 049c179 commit 1f30c80Copy full SHA for 1f30c80
instrumentation/active_record/lib/opentelemetry/instrumentation/active_record/patches/querying.rb
@@ -18,17 +18,11 @@ class << base
18
19
# Contains ActiveRecord::Querying to be patched
20
module ClassMethods
21
- if ::ActiveRecord.version >= Gem::Version.new('7.0.0')
22
- def _query_by_sql(...)
23
- tracer.in_span("#{self} query") do
24
- super
25
- end
26
27
- else
28
- def find_by_sql(...)
29
30
31
+ method_name = ::ActiveRecord.version >= Gem::Version.new('7.0.0') ? :_query_by_sql : :find_by_sql
+
+ define_method(method_name) do |*args, **kwargs|
+ tracer.in_span("#{self} query") do
+ super(*args, **kwargs)
32
end
33
34
0 commit comments