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

Quick fix for "undefined local variable or method `query_string #597

Merged
merged 2 commits into from Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -8,6 +8,7 @@ gemspec
group :test do
gem 'codecov', require: false
gem 'stackprof', require: false
gem 'memory_profiler', require: false
end

group :development do
Expand Down
2 changes: 1 addition & 1 deletion lib/mini_profiler/actions.rb
Expand Up @@ -133,7 +133,7 @@ def serve_profile_memory(env, client_settings)
)
end

query_params = Rack::Utils.parse_nested_query(query_string)
query_params = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
options = {
ignore_files: query_params['memory_profiler_ignore_files'],
allow_files: query_params['memory_profiler_allow_files'],
Expand Down
28 changes: 28 additions & 0 deletions spec/integration/mini_profiler_spec.rb
Expand Up @@ -141,6 +141,34 @@ def app
end
end

it 'works with memory_profiler' do
pid = fork do # Avoid polluting main process with stackprof
require 'memory_profiler'

# Should store flamegraph for ?pp=profile-memory
Rack::MiniProfiler.config.enable_advanced_debugging_tools = true
get '/html?pp=profile-memory'
expect(last_response).to be_ok
expect(last_response.body).to match(/allocated memory by gem/)
expect(last_response.body).to match(/allocated memory by file/)
expect(last_response.body).to match(/allocated memory by location/)
expect(last_response.body).to match(/allocated memory by class/)
expect(last_response.body).to match(/allocated objects by gem/)
expect(last_response.body).to match(/allocated objects by file/)
expect(last_response.body).to match(/allocated objects by location/)
expect(last_response.body).to match(/allocated objects by class/)
expect(last_response.body).to match(/retained objects by gem/)
expect(last_response.body).to match(/retained objects by file/)
expect(last_response.body).to match(/retained objects by location/)
expect(last_response.body).to match(/retained objects by class/)
expect(last_response.body).to match(/Allocated String Report/)
expect(last_response.body).to match(/Retained String Report/)
end

Process.wait(pid)
expect($?.exitstatus).to eq(0)
end

it 'works with async-flamegraph' do
pid = fork do # Avoid polluting main process with stackprof
require 'stackprof'
Expand Down