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
363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/scout_apm/instruments/active_record.rb', line 363 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
391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/scout_apm/instruments/active_record.rb', line 391 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
406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/scout_apm/instruments/active_record.rb', line 406 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
376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/scout_apm/instruments/active_record.rb', line 376 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 |