Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord callbacks tracking #326

Open
anirbanmu opened this issue Apr 2, 2020 · 0 comments
Open

ActiveRecord callbacks tracking #326

anirbanmu opened this issue Apr 2, 2020 · 0 comments

Comments

@anirbanmu
Copy link

I'm attempting to use this process (https://docs.scoutapm.com/#ruby-custom-instrumentation) to instrument methods in an ActiveRecord model. These methods that I instrumented are used as callbacks like (before_save). Snippet that shows what I'm doing:

# frozen_string_literal: true

class Record < ApplicationRecord
  include ::ScoutApm::Tracer

  before_save :do_something_before_save

  def do_something_before_save
    puts 'doing something before save'
  end
  
  instrument_method :do_something_before_save
end

What I'm noticing in traces on the web Scout UI is that it seems like this method is not grouped as a separate metric (I don't see any metrics for it at all). I was guessing it was being counted as ActiveRecord and under the call for Record.create! since it's called by ActiveRecord on our behalf.

Can anyone shed any light on what I might be doing wrong here? I would like to see the metric for this method separately and not counted inside the ActiveRecord category/call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant