Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixed a conflict between rack-contrib and ruby-prof #18

Closed
wants to merge 2 commits into from

5 participants

@mirakui

"RubyProf" descriptions in lib/rack/contrib/profiler.rb are conflict with latest version of ruby-prof.
Replaced them to "::RubyProf" and it works well.
https://github.com/rdp/ruby-prof/issues/issue/44

issei-naruta added some commits
@matth

Hi, this fixes a fairly annoying bug with the new versions of ruby-prof - they have added their own middleware:

https://github.com/rdp/ruby-prof/blob/master/lib/ruby-prof/rack.rb

Can you do a pull request to rack/rack-contrib and see if we can get this in the main branch? I'd rather use this middleware.

Put a ticket in with the ruby-prof guys too, just to make them aware of the conflict ...

https://github.com/rdp/ruby-prof/issues/issue/44

OK I sent pull-request to them.
Thank you for your notification :)

@eric1234

+1

I prefer the rack-contrib version (as it doesn't write to a file but instead sends out to the webserver). Changing my Gemfile to use mirakui's fork solved my problem. Thanks everybody!

@mpalmer mpalmer added the mpalmer-ok label
@mpalmer mpalmer referenced this pull request
Closed

Profiler cleanup #24

@jjb
Collaborator
jjb commented

The link to the above ticket is broken, here is the new one: ruby-prof/ruby-prof#44

@jjb
Collaborator
jjb commented

Looks like the ruby-prof project fixed this on their end in 2010. I'm closing this PR.

@jjb jjb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 15, 2010
  1. changed RubyProf into ::RubyProf

    issei-naruta authored
  2. ::RubyProf again

    issei-naruta authored
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 11 deletions.
  1. +11 −11 lib/rack/contrib/profiler.rb
View
22 lib/rack/contrib/profiler.rb
@@ -16,13 +16,13 @@ class Profiler
gc_time
)
- DEFAULT_PRINTER = RubyProf::CallTreePrinter
+ DEFAULT_PRINTER = ::RubyProf::CallTreePrinter
DEFAULT_CONTENT_TYPE = 'application/octet-stream'
PRINTER_CONTENT_TYPE = {
- RubyProf::FlatPrinter => 'text/plain',
- RubyProf::GraphPrinter => 'text/plain',
- RubyProf::GraphHtmlPrinter => 'text/html'
+ ::RubyProf::FlatPrinter => 'text/plain',
+ ::RubyProf::GraphPrinter => 'text/plain',
+ ::RubyProf::GraphHtmlPrinter => 'text/html'
}
# Accepts a :printer => [:call_tree|:graph_html|:graph|:flat] option
@@ -43,10 +43,10 @@ def call(env)
private
def profiling?(env)
- unless RubyProf.running?
+ unless ::RubyProf.running?
request = Rack::Request.new(env.clone)
if mode = request.params.delete('profile')
- if RubyProf.const_defined?(mode.upcase)
+ if ::RubyProf.const_defined?(mode.upcase)
mode
else
env['rack.errors'].write "Invalid RubyProf measure_mode: " +
@@ -58,10 +58,10 @@ def profiling?(env)
end
def profile(env, mode)
- RubyProf.measure_mode = RubyProf.const_get(mode.upcase)
+ ::RubyProf.measure_mode = ::RubyProf.const_get(mode.upcase)
GC.enable_stats if GC.respond_to?(:enable_stats)
- result = RubyProf.profile do
+ result = ::RubyProf.profile do
@times.times { @app.call(env) }
end
GC.disable_stats if GC.respond_to?(:disable_stats)
@@ -78,7 +78,7 @@ def print(printer, result)
def headers(printer, env, mode)
headers = { 'Content-Type' => PRINTER_CONTENT_TYPE[printer] || DEFAULT_CONTENT_TYPE }
- if printer == RubyProf::CallTreePrinter
+ if printer == ::RubyProf::CallTreePrinter
filename = ::File.basename(env['PATH_INFO'])
headers['Content-Disposition'] =
%(attachment; filename="#{filename}.#{mode}.tree")
@@ -93,8 +93,8 @@ def parse_printer(printer)
printer
else
name = "#{camel_case(printer)}Printer"
- if RubyProf.const_defined?(name)
- RubyProf.const_get(name)
+ if ::RubyProf.const_defined?(name)
+ ::RubyProf.const_get(name)
else
DEFAULT_PRINTER
end
Something went wrong with that request. Please try again.