简体   繁体   中英

How to get memprof (within rails) to track all the before filters and then the action before it dumps the output?

Based on the Memprof gem docs, in order to get the Memprof::Middleware working with rails we need wrap each request within Memprof.track.

The question is: How do I do this in such a way that memprof tracks all the before filters and then the action before it dumps the output?

without knowing anything about Memprof nor knowing much about what you're trying to accomplish, here's my best guess.

in your application_controller.rb:

before_filter :do_memprof_stuff

def do_memprof_stuff
  # make it really sweet
end

that'll do memprof stuff before any before filters that are defined in other controllers are called. You could obviously move that into an engine pretty easily so you could include it in any project, but I'll leave the as an exercise to the OP since I'm not sure if I'm even answering his question :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM