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
Mini Profiler UI not displayed when the response is JSON #243
Comments
It's impossible for the profiler to show up on JSON requests, because the browser only expects JSON. For HTML requests, we insert JS to render the profiler. The only way to get around that is by making rack-mini-profiler a browser extension, but that's a huge amount of work. |
The request is to actively push events to the browsers. The infrastructure is not in place for this. It seems websockets /server sent events is overkill here. Maybe when chrome adds adds header cookies for performance data this may become more viable |
A custom page that does a req say every 5-10 seconds to update the list should do the trick without enormous amounts of added complexity. Alternatively you could use message bus on such a page. Totally support shipping a sample or even a custom page for dealing with this. |
The profiler UI will not show up on /404.html in production environment for a rails-api project. The Repo: https://github.com/southwolf/rack-profiler-in-production Ruby Version: 2.2.4, Rails version: 4.2.5.1 |
Thanks @southwolf could you create a PR for your issue? This seems like a separate thread. |
I am currently experiencing the same issue as @southwolf and would appreciate some pointers on what to do. I have a rails app that I initialized with the api defaults:
|
@SamSaffron or others around, what is the recommended way of using rack-mini-profiler with Rails in API only mode? |
Also have an API only app that I'd like to monitor |
Maybe it's possible to add new |
@oyeanuj / @printercu the workaround is in the OP use two browser windows, one open to an HTML page. I think we should ship a blank page people can just hit so you can do |
How is the profile info sent back to the browser normally? Is there some way to just update the DOM with JSON request profiles as they arrive? Reason I ask is because JSON requests that are mounted in Vue components get profiled just fine as part of the main page load profile I think. Seems like it would't be too difficult to include new subsequent AJAX requests, but I'm not sure how MP works and wouldn't know where to start. |
I added an empty page to my API-only project, but the page doesn't seem to load any resource from I wonder if it has something to do with the fact that the |
Never mind. I think I finally made it work. I just added a completely empty controller action, and left a corresponding template file under Also note that you do need to have at least the |
So it does look like I had to change |
I'm trying to update #396, but I got a trouble.
Then puma don't receive any commands and other requests vanish. |
I'm having the same problem, does somebody have any clue of how to fix this?
|
@OsamaSayegh can you test this out? I would like to make sure |
Looks like I missed this one, sorry! I tested
Is there something I missed here? I was not aware of this little feature so I'm not familiar with how it's supposed to work. |
@rinkei @jvalenciag I was able to reproduce this "error" you got but I don't think it's a legit error. If you go to |
PR merged, closing this issue. |
Hello |
In a Rails JSON API, the profiler UI is not displayed, which is unfortunate!
A workaround is easy though; you need two tabs open - one for the JSON, one for the profiler. The second tab needs to be any page that renders HTML (for example the root route
/
). Make the JSON request, then refresh the page that renders HTML, and the profiler UI will show the JSON request.Can this be fixed so that the profiler UI shows up on JSON-only pages, or is this by design (and why)?
The text was updated successfully, but these errors were encountered: