SamSaffron/MiniProfiler

miniprofiler for pure json API in sinatra/padrino

Closed this issue · 4 comments

Hi, i'm trying to use miniprofiler for my project which is written using padrino/sinatra (Ruby). The problem is that the backend is a pure API and only offer json's as views, so "injecting" method is not possible.

There is any way to render miniprofilers views or redirect them, from/to a specific path (something like "/miniprofiler" ), and treat them as dedicate views?

Thanks in advance.

Same question. I'm building API services in Rails.Thanks.

It should work fine, you can always view results via:

http://site/mini-profiler-resources/results?id=[ID]

if you are using the filesystem the ids are all in the cache directory, if you are using redis you will have to iterate through it.

Open to adding a route that lists all cached results if anyone is feeling brave.

Could you please explain in detail what are the ids?

Here is my tmp/miniprofiler/:
4460917 -rw-r--r-- 1 neng users 3.8K May 6 09:51 mp_timers_4jgnsct4qey04ec2qtc
4460919 -rw-r--r-- 1 neng users 1.4K May 6 09:51 mp_timers_4koibygwa95v8ffzoimu
4460916 -rw-r--r-- 1 neng users 4.0K May 6 09:51 mp_timers_gl07mxgd0pq3yqwqn3mq
4460918 -rw-r--r-- 1 neng users 1.4K May 6 09:51 mp_timers_sul280mewan8bfvgkxrn
4460920 -rw-r--r-- 1 neng users 1.4K May 6 09:51 mp_timers_wqbkz0bvnyxb7qgkj9uy
4460915 -rw-r--r-- 1 neng users 86 May 6 09:51 mp_views_10.185.4.115

I tried several formats for the ids:
/mini-profiler-resources/results?id=[4jgnsct4qey04ec2qtc]
mini-profiler-resources/results?id=[mp_views_10.185.4.115]
/mini-profiler-resources/results?id=mp_views_10.185.4.115

Those will give 404 like:
Request not found: mp_timers_4jgnsct4qey04ec2qtc - user 10.185.4.115

And this url:
/mini-profiler-resources/results?id=4jgnsct4qey04ec2qtc

will give:
undefined method `page_struct' for nil:NilClass

Thanks.

Just commenting with an answer, for future hopeful Googlers like myself.

You would want to try /mini-profiler-resources/results?id=4jgnsct4qey04ec2qtc