lib/rack/stackprof.rb in rack-stackprof-0.1.0 vs lib/rack/stackprof.rb in rack-stackprof-0.2.0
- old
+ new
@@ -34,11 +34,11 @@
yield
ensure
StackProf.stop
finished_at = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_microsecond)
- filename = result_filename(env: env, duration_milliseconds: (finished_at - started_at) / 1000)
- StackProf::Middleware.save(filename)
+ StackProf::Middleware.path = result_filename(env: env, duration_milliseconds: (finished_at - started_at) / 1000)
+ StackProf::Middleware.save
end
# ex: "stackprof-20171004_175816-41860-GET_v1_users-0308ms.dump"
def result_filename(env:, duration_milliseconds:)
"stackprof-#{Time.now.strftime('%Y%m%d_%H%M%S')}-#{Process.pid}-#{env['REQUEST_METHOD']}#{env['REQUEST_PATH'].gsub(/[^\w]/, '_')}-#{'%04d' % duration_milliseconds.to_i}ms.dump"