Module: ScoutApm::Instruments::ActiveRecordRelationInstruments
- Defined in:
- lib/scout_apm/instruments/active_record.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete_all_with_scout_instruments(*args, &block) ⇒ Object
- #destroy_all_with_scout_instruments(*args, &block) ⇒ Object
- #update_all_with_scout_instruments(*args, &block) ⇒ Object
Class Method Details
.included(instrumented_class) ⇒ Object
437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/scout_apm/instruments/active_record.rb', line 437 def self.included(instrumented_class) ::ActiveRecord::Relation.class_eval do alias_method :update_all_without_scout_instruments, :update_all alias_method :update_all, :update_all_with_scout_instruments alias_method :delete_all_without_scout_instruments, :delete_all alias_method :delete_all, :delete_all_with_scout_instruments alias_method :destroy_all_without_scout_instruments, :destroy_all alias_method :destroy_all, :destroy_all_with_scout_instruments end end |
Instance Method Details
#delete_all_with_scout_instruments(*args, &block) ⇒ Object
465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/scout_apm/instruments/active_record.rb', line 465 def delete_all_with_scout_instruments(*args, &block) model = self.name req = ScoutApm::RequestManager.lookup layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} Delete")) req.start_layer(layer) req.ignore_children! begin delete_all_without_scout_instruments(*args, &block) ensure req.acknowledge_children! req.stop_layer end end |
#destroy_all_with_scout_instruments(*args, &block) ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/scout_apm/instruments/active_record.rb', line 480 def destroy_all_with_scout_instruments(*args, &block) model = self.name req = ScoutApm::RequestManager.lookup layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} Delete")) req.start_layer(layer) req.ignore_children! begin destroy_all_without_scout_instruments(*args, &block) ensure req.acknowledge_children! req.stop_layer end end |
#update_all_with_scout_instruments(*args, &block) ⇒ Object
450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/scout_apm/instruments/active_record.rb', line 450 def update_all_with_scout_instruments(*args, &block) model = self.name req = ScoutApm::RequestManager.lookup layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} Update")) req.start_layer(layer) req.ignore_children! begin update_all_without_scout_instruments(*args, &block) ensure req.acknowledge_children! req.stop_layer end end |