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