cangwolf / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

Ability to transform http request query string #356

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The app I need to monitor uses an MVC system based on query params in the URL.  
For example the URLs look like:
/go?page=Controller1&object=4
/go?page=Controller2&param=6

I assumed I would be able to use the "http-transform-pattern" feature to 
categorize those requests, but it doesn't work because it is only applied to 
the path part of the URL, so those two requests above both look like "/go".

I need some way to apply "http-transform-pattern" to the full URL including the 
query string.

Original issue reported on code.google.com by roy.pate...@gmail.com on 25 Oct 2013 at 9:31

GoogleCodeExporter commented 9 years ago
I added an option "http-include-query-string" which includes the full query 
string in the request description (you can then further transform it using 
"http-transform-pattern".

Original comment by roy.pate...@gmail.com on 25 Oct 2013 at 1:00

Attachments:

GoogleCodeExporter commented 9 years ago
I sometimes use myself the query string as a way to control the view to render. 
But it's not common in applications. And as we can see in your 2 examples 
above, the "page" parameter would be mixed in the query string with the dynamic 
values of data.

If the query string (and so the dynamic values) were added in the http 
statistics of the monitoring, most http requests would probably be different. 
So, this parameter may invalidate the goal of the statistics to count hits and 
mean times per http request (query string not included).
And this may also introduce a bit of overhead on memory with too many different 
requests, and possibly a quite big overhead on disk used for the monitoring. 
There are already mechanisms to limit those overheads, but being at the limit 
anytime may not be at ease.

That said, you are warned and informed.
If you want to add query string in the http statistics, you can already 
override and customize the MonitoringFilter by adding the attached 
CustomMonitoringFilter class in your application.

So, you will be able to use the custom filter in your web.xml, instead of 
MonitoringFilter, like the following:
    <filter>
        <filter-name>javamelody</filter-name>
        <filter-class>mypackage.CustomMonitoringFilter</filter-class>
        <init-param>
            <param-name>include-query-string</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
    ...

This is won't fix in javamelody because uncommon and risky for users, and 
because you can customize it anyway.

Original comment by evernat@free.fr on 16 Nov 2013 at 11:07

Attachments:

GoogleCodeExporter commented 9 years ago
I don't control the source code of the application I want to monitor, but I 
guess I can build a separate jar with CustomMonitoringFilter.java and drop it 
in next to javamelody.jar.

Thanks

Original comment by roy.pate...@gmail.com on 20 Nov 2013 at 9:14