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
315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/scout_apm/instruments/active_record.rb', line 315 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
343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/scout_apm/instruments/active_record.rb', line 343 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
358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/scout_apm/instruments/active_record.rb', line 358 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
328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/scout_apm/instruments/active_record.rb', line 328 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 |