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
387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/scout_apm/instruments/active_record.rb', line 387 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
415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/scout_apm/instruments/active_record.rb', line 415 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
430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/scout_apm/instruments/active_record.rb', line 430 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
400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/scout_apm/instruments/active_record.rb', line 400 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 |