jriecken / gae-java-mini-profiler

A mini-profiler for the Google App Engine Java runtime
http://jriecken.github.io/gae-java-mini-profiler/
MIT License
20 stars 6 forks source link

make it work with non-jsp pages #4

Open antonytrupe opened 11 years ago

antonytrupe commented 11 years ago

This may already be possible(I don't think so though), so documentation is definitely needed to make this easier.

jriecken commented 11 years ago

Is there something in specific that's not working? mini_profile_includes is just a request attribute, so it should work with any templating system. I've used it in an app that uses FreeMarker templates with no issues.

antonytrupe commented 11 years ago

I meant static pages, that are served from the static content servers and don't get (pre)processed by the web server.

jriecken commented 11 years ago

I'm not sure what there would be to profile for static files (especially ones on another server). If there's no processing, then all it is is the browser downloading a file. The dev tools in most browsers can give you information about how long it's taking all of the static assets on the page to load.

Is there a specific use case you're thinking of?

antonytrupe commented 11 years ago

ajax calls, and their resulting processing on the server.

My goal in creating it is to let others(you) know is is (about to be) worked on, and to get input; I intend to own this issue.

jriecken commented 11 years ago

Cool.

antonytrupe commented 11 years ago

Having said that, feel free to assign it to me.

antonytrupe commented 11 years ago

It looks like I am going to change the packaging to war, move/copy the static resources to the webapp folder(preserving the rest of the folder structure).

I may eventually try to package it as both a jar and a war; I've never attempted that before.

I am having problems getting the mprid into static pages initially. I guess I'll have to do an ajax call to the serer right away to get things moving.

Any thoughts?

jriecken commented 11 years ago

Hm, I would rather this not have to be a separate web application (does that even work with GAE?)

The profiler right now does keep track of Ajax requests that happen after the page has loaded (ones that make it through the MiniProfilerFilter filter).

Can you give an example of the type of page you're trying to get profiling information on? It might help with figuring out how to implement it.

antonytrupe commented 11 years ago

/stuff.html, where there are user actions that cause requests to be made but do not cause a full page (re)load. Unless I am missing something, there is not a simple way to enable the profiling on static pages like this for the ajax calls, though I could be missing something.

It wouldn't be a "separate web application"; making it a war dependency allows maven dependency management to copy "resource" files from the dependency to the target project.

jriecken commented 11 years ago

Ah, yeah I see what your issue is now. I'm not sure that it's going to be easy (or possible) to inject the profile viewer into your static HTML page as you're not going to be able to change the contents to add the js/css/etc (especially if you want to restrict it so that not everyone viewing the page can see it)

If you don't have a lot of pages like this, you could consider making your page a JSP (or whatever template library you want to use) where the only dynamic part is the ${mini_profile_includes} variable in the <head>.

antonytrupe commented 11 years ago

I am working on making the css, js, and the all the bits in ${mini_profile_includes} able to be simply injected and/or copy/pasted into the static files. I may or may not end up with something useful.

Turning static pages into .jsp is an option I am keeping on the list. It has the downside of needing to go to the app server before serving anything instead of going to the cdn servers. The upside is that I could put all the data in the original response instead of doing an ajax call as soon as the static page loads.

antonytrupe commented 11 years ago

I've made some radical changes, including creating a pair of modules and moving all the original code to one, and a copy/edit of the resource files to a second. The first module, which is identical to the original project, is still packaged as a jar. The second module, which has modified versions of the resouce files(jquery.tmpl.min.js, mini_profiler.js, mini_profiler.html, and mini_profiler.css) is packaged as a war. The pom that contains those two modules is obviously packaged as a pom.

You can look at the changes @ https://github.com/antonytrupe/gae-java-mini-profiler/tree/war-ify, and let me know if you have any opinions, or interest is picking/choosing bits and pieces.

I also updated the readme to indicate how to include the necessary files in static pages.

By no means is this done. It is still possible I may abandon this after thinking about it some more.