Module: ScoutApm::Instruments::ActiveRecordFinderMethodsInstruments
- Defined in:
- lib/scout_apm/instruments/active_record.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(instrumented_class) ⇒ Object
187 188 189 190 191 192 193 194 195 |
# File 'lib/scout_apm/instruments/active_record.rb', line 187 def self.included(instrumented_class) ScoutApm::Agent.instance.logger.info "Instrumenting ActiveRecord::FinderMethods - #{instrumented_class.inspect}" instrumented_class.class_eval do unless instrumented_class.method_defined?(:find_with_associations_without_scout_instruments) alias_method :find_with_associations_without_scout_instruments, :find_with_associations alias_method :find_with_associations, :find_with_associations_with_scout_instruments end end end |
Instance Method Details
#find_with_associations_with_scout_instruments(*args, &block) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/scout_apm/instruments/active_record.rb', line 197 def find_with_associations_with_scout_instruments(*args, &block) req = ScoutApm::RequestManager.lookup layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName::DEFAULT_METRIC) layer.annotate_layer(:ignorable => true) req.start_layer(layer) req.ignore_children! begin find_with_associations_without_scout_instruments(*args, &block) ensure req.acknowledge_children! req.stop_layer end end |