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

AutoInstruments - Automatically break down uninstrumented time #247

Open
wants to merge 42 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@dlanderson
Copy link
Member

commented Feb 20, 2019

AutoInstruments breaks down uninstrumented Controller time automatically, by parsing the AST tree of your own application code when it boots.

Early adopters should try out the AutoInstruments Beta in staging and development environments. You can try out this Beta by following these steps:

  1. You must be running Ruby 2.3.1+

  2. In your Gemfile:

gem 'scout_apm', git: 'https://github.com/scoutapp/scout_apm_ruby.git', branch: 'auto_instruments_beta'
gem 'parser'
  1. In your config/boot.rb:
# Added AFTER `File.expand_path('../../Gemfile', __FILE__)`
# But BEFORE `require 'bundler/setup'`
require 'scout_apm/auto_instrument'
  1. Deploy!

Note - Using Bootsnap at the same time will prevent AutoInstruments from working.

If you have any questions please reach out to support@scoutapp.com!

@jsierles

This comment has been minimized.

Copy link

commented Feb 20, 2019

Note that this branch currently requires disabling bootsnap.

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Feb 22, 2019

What was wrong with the Rails module usage? Just curious.

@dlanderson

This comment has been minimized.

Copy link
Member Author

commented Feb 22, 2019

What was wrong with the Rails module usage? Just curious.

@jsierles and others hit an exception with newer Rail versions: uninitialized constant ActiveSupport::Executor (NameError). It seemed to be caused by a Rails loader while Rails was in the process of being loaded itself. Avoiding it entirely seems the safest bet.

dlanderson and others added some commits May 31, 2018

Fix `load_iseq` implementation.
- There is no `super` implementation, so invoke `compile_file`.
- The 2nd argument of `compile` should be a file name.
Improved loading of Rails controllers.
- Only match user-defined controllers in the Rails app directory.
- Revert to original source code if instrumentation fails.

@ioquatix ioquatix force-pushed the auto_instruments branch from 0b17533 to 5acdaff Mar 14, 2019

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Mar 14, 2019

I have rebased on master.

@ioquatix ioquatix force-pushed the auto_instruments branch from 5acdaff to ac9f61c Mar 14, 2019

@jonekdahl

This comment has been minimized.

Copy link

commented Mar 16, 2019

Is there already a config switch to enable/disable AutoInstruments? Otherwise, I'd like to request one.

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Mar 16, 2019

@jonekdahl

if ENV['AUTO_INSTRUMENT']
  require 'scout_apm/auto_instrument'
end

Does that work for you?

@jonekdahl

This comment has been minimized.

Copy link

commented Mar 16, 2019

@ioquatix Yes, that seems to work, thanks. Although I think people will expect a regular Scout config, like http://help.apm.scoutapp.com/#profile.

@jsierles

This comment has been minimized.

Copy link

commented May 31, 2019

Has this work been abandoned? We tried this on our production environment, and found that many traces showed even less information the previous traces, so we reverted.

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2019

@jsierles do you mind giving me a bit more feedback?

We could try rebasing on master. In theory it shouldn't be less than before, and ideally more.

@jeremy

This comment has been minimized.

Copy link

commented Jun 24, 2019

# Added AFTER `File.expand_path('../../Gemfile', __FILE__)`
# But BEFORE `require 'bundler/setup'`
require 'scout_apm/auto_instrument'

How can this work, considering scout_apm is itself bundled?

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Jun 24, 2019

@jeremy I believe this goes into your own config config/boot.rb so File.expand_path('../../Gemfile', __FILE__) resolves to Gemfile in your app - is that what you were questioning?

@jeremy

This comment has been minimized.

Copy link

commented Jun 27, 2019

@ioquatix Bundler setup is what sets up the load path so bundled gems can be required… so how can we require scout_apm BEFORE Bundler setup, unless you require installation as a system gem? (Pardon if I'm missing something here!)

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

@itsderek23 if you want to do a rebase on master I am also happy with that.

@itsderek23

This comment has been minimized.

Copy link
Member

commented Jul 11, 2019

@ioquatix - thanks! Not ready quite yet - we're getting our ducks in a row for this.

@ioquatix

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

I would suggest hard reset to 4e8a98a and rebase on master, then squash merge. There are lots of WIP commits. Let me know if you want me to squash it down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.