Java Simon 3.5.0

org.javasimon.javaee.reqreporter
Class DefaultRequestReporter

java.lang.Object
  extended by org.javasimon.javaee.reqreporter.DefaultRequestReporter
All Implemented Interfaces:
RequestReporter
Direct Known Subclasses:
StandardRequestReporter

public class DefaultRequestReporter
extends Object
implements RequestReporter

Reports significant splits (longer than 5% of the request) and list of all used stopwatches with their split counts. Report is sent through Manager.message(String). Following aspects of the class can be overridden:

Author:
Richard "Virgo" Richter

Nested Class Summary
protected  class DefaultRequestReporter.StopwatchInfo
           
 
Constructor Summary
DefaultRequestReporter()
           
 
Method Summary
protected  boolean isSignificantSplit(Split split, Split requestSplit)
          Can be overridden to decide whether Split is considered significant to be reported in the first part of the output.
protected  void reportMessage(String message)
          Reports the prepared message through the method Manager.message(String) - can be overridden to emit the message to log/console/etc.
 void reportRequest(javax.servlet.http.HttpServletRequest request, Split requestSplit, List<Split> splits)
          Reports request that exceeds the threshold.
 void setSimonServletFilter(SimonServletFilter simonServletFilter)
          Called by initialization after the instance creation.
protected  boolean shouldBeAddedStopwatchInfo(DefaultRequestReporter.StopwatchInfo info)
          Decides whether stopwatch info should be included in the report - by default all are included.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRequestReporter

public DefaultRequestReporter()
Method Detail

reportRequest

public void reportRequest(javax.servlet.http.HttpServletRequest request,
                          Split requestSplit,
                          List<Split> splits)
Description copied from interface: RequestReporter
Reports request that exceeds the threshold.

Specified by:
reportRequest in interface RequestReporter
Parameters:
request - offending HTTP request
requestSplit - split measuring the offending request
splits - list of all splits started for this request

reportMessage

protected void reportMessage(String message)
Reports the prepared message through the method Manager.message(String) - can be overridden to emit the message to log/console/etc.

Parameters:
message - prepared message with report

isSignificantSplit

protected boolean isSignificantSplit(Split split,
                                     Split requestSplit)
Can be overridden to decide whether Split is considered significant to be reported in the first part of the output. By default all Splits with time over 5% of total request time are significant. This includes overlapping splits too, so more than 20 splits can be reported.

Parameters:
split - tested Split
requestSplit - Split for the whole HTTP request
Returns:
true, if tested Split is significant

shouldBeAddedStopwatchInfo

protected boolean shouldBeAddedStopwatchInfo(DefaultRequestReporter.StopwatchInfo info)
Decides whether stopwatch info should be included in the report - by default all are included.

Parameters:
info - stopwatch info contains list of all splits, max split and total time of splits for the reported request
Returns:
true, if the stopatch info should be reported

setSimonServletFilter

public void setSimonServletFilter(SimonServletFilter simonServletFilter)
Description copied from interface: RequestReporter
Called by initialization after the instance creation. Useful when Manager is needed (SimonServletFilter.getManager()) and possibly for other scenarios.

Specified by:
setSimonServletFilter in interface RequestReporter

Java Simon 3.5.0

Copyright © 2014. All rights reserved.