Collect information about the split taking too long

11 views
Skip to first unread message

Michael Dussere

unread,
Apr 29, 2015, 8:15:13 AM4/29/15
to java...@googlegroups.com
Hi, 

I consider using simon for our project (so far it looks very very nice).

I'm looking for a way to get information on the best/worst splits. 
Typically I want to identify which request taking a long time. 

I saw that the split can get attributes and it is sufficient to me regarding the information but is there a way to keep the min/max split for my final logging ?
Is there a more "standard" way to identify the pathological requests ?


Thanks in advance

Michael

Richard Richter

unread,
Apr 29, 2015, 5:31:20 PM4/29/15
to java...@googlegroups.com
Hi Michael

This is not impossible, but it's not easy either right now -
especially not for minimal Splits.

Firstly - I don't know what version of Simon you're using, that is
important to know for me.

I guess you're talking about HTTP requests, hence about
SimonServletFilter. There is one crucial method that can be
overridden:
protected boolean shouldBeReported(HttpServletRequest request, long
requestNanoTime, List<Split> splits) {...

That one decided whether you ask "reporter" to report your requests
with all its splits. Tricky part here is that you only know the time,
and you can't easily say whether it is minimum time. So you can go for
option to report everything - override the filter, use your class
instead of default SimonServletFilter in your web.xml and you're
halfway done. The second step is the reporter.

You may want to override
org.javasimon.javaee.reqreporter.RequestReporter#reportRequest, to
make your life easier, again extend from existing class - like
PlainRequestReporter. In your code you can compare the requestSplit
with its stopwatch min/max values, something like:
Stopwatch requestStopwatch = requestSplit.getStopwatch();
if (requestStopwatch.getMax() == requestSplit.runningFor()) {
requestStopwatch.setAttribute("maxSplit", requestSplit);
}
// and the same for min

This way you keep your min/max split in stopwatch's attributes, which
is around much longer than kinda transient splits are. This is per URL
- various stopwatches for various URLs. If you want some global
stopwatch, simply get it like:
Stopwatch globalHttpStopwatch =
simonServletFilter.getManager().getStopwatch("global");

Now when your split is stored in attribute, you can store list of all
splits from that request the same way into another attribute, either
on the stopwatch or in some attribute of that request split...
actually at this moment it's completely up to you what you will do
with the data.

Cheers

Virgo
> --
> You received this message because you are subscribed to the Google Groups
> "javasimon" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to javasimon+...@googlegroups.com.
> To post to this group, send email to java...@googlegroups.com.
> Visit this group at http://groups.google.com/group/javasimon.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages