Module: ScoutApm::Instruments::ActiveRecordRelationQueryInstruments
- Defined in:
- lib/scout_apm/instruments/active_record.rb
Class Method Summary collapse
Instance Method Summary collapse
- #exec_queries(*args, &block) ⇒ Object (also: #exec_queries_with_scout_instruments)
Class Method Details
.included(instrumented_class) ⇒ Object
373 374 375 376 377 378 379 380 381 |
# File 'lib/scout_apm/instruments/active_record.rb', line 373 def self.included(instrumented_class) ScoutApm::Agent.instance.context.logger.info "Instrumenting ActiveRecord::Relation#exec_queries - #{instrumented_class.inspect}" instrumented_class.class_eval do unless instrumented_class.method_defined?(:exec_queries_without_scout_instruments) alias_method :exec_queries_without_scout_instruments, :exec_queries alias_method :exec_queries, :exec_queries_with_scout_instruments end end end |
Instance Method Details
#exec_queries(*args, &block) ⇒ Object Also known as: exec_queries_with_scout_instruments
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/scout_apm/instruments/active_record.rb', line 383 def exec_queries(*args, &block) req = ScoutApm::RequestManager.lookup layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName::DEFAULT_METRIC) layer.annotate_layer(:ignorable => true) layer.desc = SqlList.new req.start_layer(layer) req.ignore_children! begin if ScoutApm::Environment.instance.supports_module_prepend? super(*args, &block) else exec_queries_without_scout_instruments(*args, &block) end ensure req.acknowledge_children! req.stop_layer end end |