SamSaffron / flamegraph

Flamegraph profiling support for Ruby 2.0
MIT License
382 stars 36 forks source link

Application with flamegraph installed fails to load (missing deps) #19

Closed pik closed 8 years ago

pik commented 8 years ago

So flamegraph will attempt to require either stackprof or fast_stack

if RUBY_VERSION >= "2.1.0".freeze
  begin
    require "stackprof"
  rescue LoadError
    STDERR.puts "Please require the stackprof gem falling back to fast_stack"
    require "fast_stack"
  end

When the later fails Rails Server / Console will fail to initialize and exit. Should one of these be added to the dependency list, or otherwise the a rescue added for require "fast_stack" ?

SamSaffron commented 8 years ago

I am not sure what we can do here, without both of these gem flamegraph is broken, why include it?

pik commented 8 years ago

Would something like this do it or is stackprof not an option in some environments?

spec.add_dependency( RUBY_VERSION >= "2.1.0".freeze ? "stackprof" : "fast_stack" )
SamSaffron commented 8 years ago

nope, fast_stack still works on 2.1.0 its just that stackprof is preferred cause it uses the new profiling apis

josh-lendeavor commented 8 years ago

I started getting this error when I moved to Ruby 2.3.1 I'm not sure if it's the Ruby upgrade of the Bundler upgrade to 1.12.5, but my application is unable to find either stackprof or fast_stack.

SamSaffron commented 8 years ago

wait, did you add either of those gems to your bundle?

On Thu, Jun 2, 2016 at 6:00 AM, josh-lendeavor notifications@github.com wrote:

I started getting this error when I moved to Ruby 2.3.1 I'm not sure if it's the Ruby upgrade of the Bundler upgrade to 1.12.5, but my application is unable to find either stackprof or fast_stack.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SamSaffron/flamegraph/issues/19#issuecomment-223107226, or mute the thread https://github.com/notifications/unsubscribe/AAAUXbiDuOdvUP8rX5noHKAvYzALfzhOks5qHeTMgaJpZM4IlYEt .

josh-lendeavor commented 8 years ago

Yea, it turns out my problem was neither of those gems was added to the bundle. It worked before with them being installed on the system, and not being in the bundle. Now they are required to be part of the bundle. So, I'm not sure if any action is required here.

Although, if one of them was required by default then this gem would work out of the box. We wouldn't need to find and be declaring dependencies of gems in our Gemfile.

nickrivadeneira commented 8 years ago

@SamSaffron Is adding either stackprof or fast_stack to the Gemfile a requirement for installation? Nothing is mentioned of this in the README, but my impression is that it is required. If so, I'd be happy to open a PR to add it to the README.

SamSaffron commented 8 years ago

Yes either are required, I think fairly soon we can drop support for 2.0 and make stackprof a strong requirement.

On Fri, Sep 2, 2016 at 6:54 AM, Nick Rivadeneira notifications@github.com wrote:

@SamSaffron https://github.com/SamSaffron Is adding either stackprof or fast_stack to the Gemfile a requirement for installation? Nothing is mentioned of this in the README, but my impression is that it is required. If so, I'd be happy to open a PR to add it to the README.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SamSaffron/flamegraph/issues/19#issuecomment-244209353, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAUXed2apzdypaOSuykJgHNzsantdZYks5qlzuggaJpZM4IlYEt .