- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.server.handler.AbstractHandler
-
- org.eclipse.jetty.server.handler.AbstractHandlerContainer
-
- org.eclipse.jetty.server.handler.HandlerWrapper
-
- org.eclipse.jetty.server.handler.StatisticsHandler
-
- All Implemented Interfaces:
Handler,HandlerContainer,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Graceful,org.eclipse.jetty.util.component.LifeCycle
@ManagedObject("Request Statistics Gathering") public class StatisticsHandler extends HandlerWrapper implements org.eclipse.jetty.util.component.Graceful
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.server.handler.AbstractHandler
AbstractHandler.ErrorDispatchHandler
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
_handler
-
-
Constructor Summary
Constructors Constructor Description StatisticsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoStart()protected voiddoStop()intgetAsyncDispatches()intgetAsyncRequests()intgetAsyncRequestsWaiting()intgetAsyncRequestsWaitingMax()intgetDispatched()intgetDispatchedActive()intgetDispatchedActiveMax()longgetDispatchedTimeMax()doublegetDispatchedTimeMean()doublegetDispatchedTimeStdDev()longgetDispatchedTimeTotal()intgetExpires()intgetRequests()intgetRequestsActive()intgetRequestsActiveMax()longgetRequestTimeMax()doublegetRequestTimeMean()doublegetRequestTimeStdDev()longgetRequestTimeTotal()intgetResponses1xx()intgetResponses2xx()intgetResponses3xx()intgetResponses4xx()intgetResponses5xx()longgetResponsesBytesTotal()longgetStatsOnMs()voidhandle(java.lang.String path, Request baseRequest, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)Handle a request.booleanisShutdown()java.util.concurrent.CompletableFuture<java.lang.Void>shutdown()voidstatsReset()Resets the current request statistics.java.lang.StringtoStatsHTML()java.lang.StringtoString()protected voidupdateResponse(Request request)-
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
destroy, expandChildren, getHandler, getHandlers, insertHandler, setHandler
-
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
-
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
doError, getServer
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
statsReset
@ManagedOperation(value="resets statistics", impact="ACTION") public void statsReset()Resets the current request statistics.
-
handle
public void handle(java.lang.String path, Request baseRequest, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws java.io.IOException, jakarta.servlet.ServletExceptionDescription copied from interface:HandlerHandle a request.- Specified by:
handlein interfaceHandler- Overrides:
handlein classHandlerWrapper- Parameters:
path- The target of the request - either a URI or a name.baseRequest- The original unwrapped request object.request- The request either as theRequestobject or a wrapper of that request. Themethod can be used access the Request object if required.HttpConnection.getCurrentConnection().getHttpChannel().getRequest()response- The response as theResponseobject or a wrapper of that request. Themethod can be used access the Response object if required.HttpConnection.getCurrentConnection().getHttpChannel().getResponse()- Throws:
java.io.IOException- if unable to handle the request or response processingjakarta.servlet.ServletException- if unable to handle the request or response due to underlying servlet issue
-
updateResponse
protected void updateResponse(Request request)
-
doStart
protected void doStart() throws java.lang.Exception- Overrides:
doStartin classAbstractHandler- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception- Overrides:
doStopin classAbstractHandler- Throws:
java.lang.Exception
-
getRequests
@ManagedAttribute("number of requests") public int getRequests()- Returns:
- the number of requests handled by this handler
since
statsReset()was last called, excluding active requests - See Also:
getAsyncDispatches()
-
getRequestsActive
@ManagedAttribute("number of requests currently active") public int getRequestsActive()- Returns:
- the number of requests currently active.
since
statsReset()was last called.
-
getRequestsActiveMax
@ManagedAttribute("maximum number of active requests") public int getRequestsActiveMax()- Returns:
- the maximum number of active requests
since
statsReset()was last called.
-
getRequestTimeMax
@ManagedAttribute("maximum time spend handling requests (in ms)") public long getRequestTimeMax()- Returns:
- the maximum time (in milliseconds) of request handling
since
statsReset()was last called.
-
getRequestTimeTotal
@ManagedAttribute("total time spend in all request handling (in ms)") public long getRequestTimeTotal()- Returns:
- the total time (in milliseconds) of requests handling
since
statsReset()was last called.
-
getRequestTimeMean
@ManagedAttribute("mean time spent handling requests (in ms)") public double getRequestTimeMean()- Returns:
- the mean time (in milliseconds) of request handling
since
statsReset()was last called. - See Also:
getRequestTimeTotal(),getRequests()
-
getRequestTimeStdDev
@ManagedAttribute("standard deviation for request handling (in ms)") public double getRequestTimeStdDev()- Returns:
- the standard deviation of time (in milliseconds) of request handling
since
statsReset()was last called. - See Also:
getRequestTimeTotal(),getRequests()
-
getDispatched
@ManagedAttribute("number of dispatches") public int getDispatched()- Returns:
- the number of dispatches seen by this handler
since
statsReset()was last called, excluding active dispatches
-
getDispatchedActive
@ManagedAttribute("number of dispatches currently active") public int getDispatchedActive()- Returns:
- the number of dispatches currently in this handler
since
statsReset()was last called, including resumed requests
-
getDispatchedActiveMax
@ManagedAttribute("maximum number of active dispatches being handled") public int getDispatchedActiveMax()- Returns:
- the max number of dispatches currently in this handler
since
statsReset()was last called, including resumed requests
-
getDispatchedTimeMax
@ManagedAttribute("maximum time spend in dispatch handling") public long getDispatchedTimeMax()- Returns:
- the maximum time (in milliseconds) of request dispatch
since
statsReset()was last called.
-
getDispatchedTimeTotal
@ManagedAttribute("total time spent in dispatch handling (in ms)") public long getDispatchedTimeTotal()- Returns:
- the total time (in milliseconds) of requests handling
since
statsReset()was last called.
-
getDispatchedTimeMean
@ManagedAttribute("mean time spent in dispatch handling (in ms)") public double getDispatchedTimeMean()- Returns:
- the mean time (in milliseconds) of request handling
since
statsReset()was last called. - See Also:
getRequestTimeTotal(),getRequests()
-
getDispatchedTimeStdDev
@ManagedAttribute("standard deviation for dispatch handling (in ms)") public double getDispatchedTimeStdDev()- Returns:
- the standard deviation of time (in milliseconds) of request handling
since
statsReset()was last called. - See Also:
getRequestTimeTotal(),getRequests()
-
getAsyncRequests
@ManagedAttribute("total number of async requests") public int getAsyncRequests()- Returns:
- the number of requests handled by this handler
since
statsReset()was last called, including resumed requests - See Also:
getAsyncDispatches()
-
getAsyncRequestsWaiting
@ManagedAttribute("currently waiting async requests") public int getAsyncRequestsWaiting()- Returns:
- the number of requests currently suspended.
since
statsReset()was last called.
-
getAsyncRequestsWaitingMax
@ManagedAttribute("maximum number of waiting async requests") public int getAsyncRequestsWaitingMax()- Returns:
- the maximum number of current suspended requests
since
statsReset()was last called.
-
getAsyncDispatches
@ManagedAttribute("number of requested that have been asynchronously dispatched") public int getAsyncDispatches()- Returns:
- the number of requests that have been asynchronously dispatched
-
getExpires
@ManagedAttribute("number of async requests requests that have expired") public int getExpires()- Returns:
- the number of requests that expired while suspended.
- See Also:
getAsyncDispatches()
-
getResponses1xx
@ManagedAttribute("number of requests with 1xx response status") public int getResponses1xx()- Returns:
- the number of responses with a 1xx status returned by this context
since
statsReset()was last called.
-
getResponses2xx
@ManagedAttribute("number of requests with 2xx response status") public int getResponses2xx()- Returns:
- the number of responses with a 2xx status returned by this context
since
statsReset()was last called.
-
getResponses3xx
@ManagedAttribute("number of requests with 3xx response status") public int getResponses3xx()- Returns:
- the number of responses with a 3xx status returned by this context
since
statsReset()was last called.
-
getResponses4xx
@ManagedAttribute("number of requests with 4xx response status") public int getResponses4xx()- Returns:
- the number of responses with a 4xx status returned by this context
since
statsReset()was last called.
-
getResponses5xx
@ManagedAttribute("number of requests with 5xx response status") public int getResponses5xx()- Returns:
- the number of responses with a 5xx status returned by this context
since
statsReset()was last called.
-
getStatsOnMs
@ManagedAttribute("time in milliseconds stats have been collected for") public long getStatsOnMs()- Returns:
- the milliseconds since the statistics were started with
statsReset().
-
getResponsesBytesTotal
@ManagedAttribute("total number of bytes across all responses") public long getResponsesBytesTotal()- Returns:
- the total bytes of content sent in responses
-
toStatsHTML
public java.lang.String toStatsHTML()
-
shutdown
public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown()
- Specified by:
shutdownin interfaceorg.eclipse.jetty.util.component.Graceful
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceorg.eclipse.jetty.util.component.Graceful
-
toString
public java.lang.String toString()
- Overrides:
toStringin classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-