request_profiler icon indicating copy to clipboard operation
request_profiler copied to clipboard

request-profiler 0.0.4 failing with ruby-prof 1.0.0

Open kikonen opened this issue 6 years ago • 3 comments

request-profiler 0.0.4 ruby-prof 1.0.0

following error occurs

uninitialized constant RubyProf::FlatPrinterWithLineNumbers

at

module Rack
  class RequestProfiler
...
    def format(printer)
      case printer
      when ::RubyProf::FlatPrinter
        'txt'
      when ::RubyProf::FlatPrinterWithLineNumbers
        'txt'
      when ::RubyProf::GraphPrinter
        'txt'
      when ::RubyProf::GraphHtmlPrinter
        'html'
      when ::RubyProf::DotPrinter
        'dot'
      when ::RubyProf::CallTreePrinter
        "out.#{Process.pid}"
      when ::RubyProf::CallStackPrinter
        'html'
      else
        'txt'
      end
    end
...

kikonen avatar Oct 10 '19 08:10 kikonen

my workaround

config/initializers/request_profiler.rb

if defined?(Rack::RequestProfiler)
  module Rack
    class RequestProfiler
      def format(printer)
        case printer
        when ::RubyProf::FlatPrinter
          'txt'
#        when ::RubyProf::FlatPrinterWithLineNumbers
#          'txt'
        when ::RubyProf::GraphPrinter
          'txt'
        when ::RubyProf::GraphHtmlPrinter
          'html'
        when ::RubyProf::DotPrinter
          'dot'
        when ::RubyProf::CallTreePrinter
          "out.#{Process.pid}"
        when ::RubyProf::CallStackPrinter
          'html'
        else
          'txt'
        end
      end
    end
  end
end

kikonen avatar Oct 10 '19 08:10 kikonen

It looks like same workaround is still relevant

kikonen avatar Jun 20 '22 12:06 kikonen

Thanks, this workaround worked for me

cdimitroulas avatar Dec 19 '22 13:12 cdimitroulas