Package org.eclipse.jetty.server.handler
Class LatencyRecordingHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.Handler.Abstract
org.eclipse.jetty.server.Handler.AbstractContainer
org.eclipse.jetty.server.Handler.Wrapper
org.eclipse.jetty.server.handler.EventsHandler
org.eclipse.jetty.server.handler.LatencyRecordingHandler
- All Implemented Interfaces:
Handler,Handler.Container,Handler.Singleton,Request.Handler,Container,Destroyable,Dumpable,Dumpable.DumpableContainer,LifeCycle,Invocable
A Handler that helps recording the total latency of the requests executed by the wrapped handler.
The latency reported by onRequestComplete(String, long) is the delay between when the request arrived to a connector until the completion of that
request.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendableNested classes/interfaces inherited from interface org.eclipse.jetty.server.Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.server.Request.Handler
Request.Handler.AbortException -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidonComplete(Request request, int status, HttpFields headers, Throwable failure) Invoked when the request and response processing are complete, just before the request and response will be recycled (i.e. after theRunnablereturn fromHttpChannel.onRequest(MetaData.Request)has returned and theCallbackpassed toRequest.Handler.handle(Request, Response, Callback)has been completed).protected abstract voidonRequestComplete(String requestId, long durationInNs) Called back for each completed request with its execution's latency.Methods inherited from class org.eclipse.jetty.server.handler.EventsHandler
handle, onAfterHandling, onBeforeHandling, onComplete, onRequestRead, onResponseBegin, onResponseTrailersComplete, onResponseWrite, onResponseWriteCompleteMethods inherited from class org.eclipse.jetty.server.Handler.Wrapper
getHandler, getInvocationType, setHandlerMethods inherited from class org.eclipse.jetty.server.Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamic, setServerMethods inherited from class org.eclipse.jetty.server.Handler.Abstract
destroy, doStart, doStop, getServerMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Destroyable
destroyMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.server.Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface org.eclipse.jetty.server.Handler.Singleton
getHandlers, getTail, insertHandler, setHandlerMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
LatencyRecordingHandler
public LatencyRecordingHandler() -
LatencyRecordingHandler
-
-
Method Details
-
onComplete
Description copied from class:EventsHandlerInvoked when the request and response processing are complete, just before the request and response will be recycled (i.e. after theRunnablereturn fromHttpChannel.onRequest(MetaData.Request)has returned and theCallbackpassed toRequest.Handler.handle(Request, Response, Callback)has been completed).- Overrides:
onCompletein classEventsHandler- Parameters:
request- the request object. Theread(),demand(Runnable)andfail(Throwable)methods must not be called by the listener.status- the response status.headers- the immutable fields of the response object.failure- if there was a failure to complete.
-
onRequestComplete
Called back for each completed request with its execution's latency.- Parameters:
requestId- the ID of the requestdurationInNs- the duration in nanoseconds of the completed request
-