module ScoutApm::Instruments::ActiveRecordUpdateInstruments

Public Instance Methods

save(*args, **options, &block) click to toggle source
Calls superclass method
# File lib/scout_apm/instruments/active_record.rb, line 402
def save(*args, **options, &block)
  model = self.class.name
  operation = self.persisted? ? "Update" : "Create"

  req = ScoutApm::RequestManager.lookup
  layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} #{operation}"))
  layer.desc = SqlList.new
  req.start_layer(layer)
  req.ignore_children!
  begin
    super(*args, **options, &block)
  ensure
    req.acknowledge_children!
    req.stop_layer
  end
end
save!(*args, **options, &block) click to toggle source
Calls superclass method
# File lib/scout_apm/instruments/active_record.rb, line 419
def save!(*args, **options, &block)
  model = self.class.name
  operation = self.persisted? ? "Update" : "Create"

  req = ScoutApm::RequestManager.lookup
  layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} #{operation}"))
  req.start_layer(layer)
  req.ignore_children!
  begin
    super(*args, **options, &block)
  ensure
    req.acknowledge_children!
    req.stop_layer
  end
end