Interface RequestLogBuilder
-
- All Known Implementing Classes:
DefaultRequestLog
public interface RequestLogBuilder
Updates aRequestLog
with newly available information.
-
-
Field Summary
Fields Modifier and Type Field Description static RequestLogBuilder
NOOP
A dummyRequestLogBuilder
that discards everything it collected.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addChild(RequestLog child)
Adds the specifiedRequestLog
so that the logs are propagated from thechild
.void
deferRequestContent()
Allows therequestContent(Object, Object)
called afterendRequest()
.void
deferResponseContent()
Allows theresponseContent(Object, Object)
called afterendResponse()
.void
endRequest()
Finishes the collection of theRequest
information.void
endRequest(long requestEndTimeNanos)
Finishes the collection of theRequest
information.void
endRequest(Throwable requestCause)
Finishes the collection of theRequest
information.void
endRequest(Throwable requestCause, long requestEndTimeNanos)
Finishes the collection of theRequest
information.void
endResponse()
Finishes the collection of theResponse
information.void
endResponse(long responseEndTimeNanos)
Finishes the collection of theResponse
information.void
endResponse(Throwable responseCause)
Finishes the collection of theResponse
information.void
endResponse(Throwable responseCause, long responseEndTimeNanos)
Finishes the collection of theResponse
information.void
endResponseWithLastChild()
Fills the response-side logs from the last added child.void
increaseRequestLength(long deltaBytes)
Increases theRequestLog.requestLength()
bydeltaBytes
.void
increaseRequestLength(HttpData data)
void
increaseResponseLength(long deltaBytes)
Increases theRequestLog.responseLength()
bydeltaBytes
.void
increaseResponseLength(HttpData data)
boolean
isRequestContentDeferred()
Returnstrue
ifdeferRequestContent()
was ever called.boolean
isResponseContentDeferred()
Returnstrue
ifdeferResponseContent()
was ever called.void
requestContent(Object requestContent, Object rawRequestContent)
Sets theRequestLog.requestContent()
and theRequestLog.rawRequestContent()
.void
requestContentPreview(String requestContentPreview)
Sets theRequestLog.requestContentPreview()
.void
requestFirstBytesTransferred()
void
requestFirstBytesTransferred(long requestFirstBytesTransferredNanos)
SetsRequestLog.requestFirstBytesTransferredTimeNanos()
with the specified timestamp.void
requestHeaders(RequestHeaders requestHeaders)
Sets theRequestLog.requestHeaders()
.void
requestLength(long requestLength)
Sets theRequestLog.requestLength()
.void
requestTrailers(HttpHeaders requestTrailers)
Sets theRequestLog.requestTrailers()
.void
responseContent(Object responseContent, Object rawResponseContent)
Sets theRequestLog.responseContent()
and theRequestLog.rawResponseContent()
.void
responseContentPreview(String responseContentPreview)
Sets theRequestLog.responseContentPreview()
.void
responseFirstBytesTransferred()
void
responseFirstBytesTransferred(long responseFirstBytesTransferredNanos)
SetsRequestLog.responseFirstBytesTransferredTimeNanos()
with the specified timestamp.void
responseHeaders(ResponseHeaders responseHeaders)
Sets theRequestLog.responseHeaders()
.void
responseLength(long responseLength)
Sets theRequestLog.responseLength()
.void
responseTrailers(HttpHeaders responseTrailers)
Sets theRequestLog.responseTrailers()
.void
serializationFormat(SerializationFormat serializationFormat)
Sets theSerializationFormat
.default void
startRequest(Channel channel, SessionProtocol sessionProtocol)
Starts the collection of theRequest
information.default void
startRequest(Channel channel, SessionProtocol sessionProtocol, long requestStartTimeNanos, long requestStartTimeMicros)
Starts the collection of theRequest
information.void
startRequest(Channel channel, SessionProtocol sessionProtocol, SSLSession sslSession)
Starts the collection of theRequest
information.void
startRequest(Channel channel, SessionProtocol sessionProtocol, SSLSession sslSession, long requestStartTimeNanos, long requestStartTimeMicros)
Starts the collection of theRequest
information.void
startResponse()
Starts the collection ofResponse
information.void
startResponse(long responseStartTimeNanos, long responseStartTimeMicros)
Starts the collection ofResponse
information.
-
-
-
Field Detail
-
NOOP
static final RequestLogBuilder NOOP
A dummyRequestLogBuilder
that discards everything it collected.
-
-
Method Detail
-
addChild
void addChild(RequestLog child)
Adds the specifiedRequestLog
so that the logs are propagated from thechild
. Note that only the request-side logs of the first added child will be propagated. To fill the response-side logs you need to callendResponseWithLastChild()
.
-
endResponseWithLastChild
void endResponseWithLastChild()
Fills the response-side logs from the last added child. Note that already fulfilledRequestLogAvailability
s in the child log will be propagated immediately.
-
startRequest
default void startRequest(Channel channel, SessionProtocol sessionProtocol)
Starts the collection of theRequest
information. This method sets the following properties:- Parameters:
channel
- theChannel
which handled theRequest
.sessionProtocol
- theSessionProtocol
of the connection.
-
startRequest
void startRequest(Channel channel, SessionProtocol sessionProtocol, @Nullable SSLSession sslSession)
Starts the collection of theRequest
information. This method sets the following properties:- Parameters:
channel
- theChannel
which handled theRequest
.sessionProtocol
- theSessionProtocol
of the connection.sslSession
- theSSLSession
of the connection, ornull
.
-
startRequest
default void startRequest(Channel channel, SessionProtocol sessionProtocol, long requestStartTimeNanos, long requestStartTimeMicros)
Starts the collection of theRequest
information. This method sets the following properties:- Parameters:
channel
- theChannel
which handled theRequest
.sessionProtocol
- theSessionProtocol
of the connection.requestStartTimeNanos
-System.nanoTime()
value when the request started.requestStartTimeMicros
- the number of microseconds since the epoch, e.g.System.currentTimeMillis() * 1000
.
-
startRequest
void startRequest(Channel channel, SessionProtocol sessionProtocol, @Nullable SSLSession sslSession, long requestStartTimeNanos, long requestStartTimeMicros)
Starts the collection of theRequest
information. This method sets the following properties:- Parameters:
channel
- theChannel
which handled theRequest
.sessionProtocol
- theSessionProtocol
of the connection.sslSession
- theSSLSession
of the connection, ornull
.requestStartTimeNanos
-System.nanoTime()
value when the request started.requestStartTimeMicros
- the number of microseconds since the epoch, e.g.System.currentTimeMillis() * 1000
.
-
serializationFormat
void serializationFormat(SerializationFormat serializationFormat)
Sets theSerializationFormat
.
-
increaseRequestLength
void increaseRequestLength(long deltaBytes)
Increases theRequestLog.requestLength()
bydeltaBytes
.
-
increaseRequestLength
void increaseRequestLength(HttpData data)
-
requestLength
void requestLength(long requestLength)
Sets theRequestLog.requestLength()
.
-
requestFirstBytesTransferred
void requestFirstBytesTransferred()
-
requestFirstBytesTransferred
void requestFirstBytesTransferred(long requestFirstBytesTransferredNanos)
SetsRequestLog.requestFirstBytesTransferredTimeNanos()
with the specified timestamp.
-
requestHeaders
void requestHeaders(RequestHeaders requestHeaders)
Sets theRequestLog.requestHeaders()
.
-
requestContent
void requestContent(@Nullable Object requestContent, @Nullable Object rawRequestContent)
Sets theRequestLog.requestContent()
and theRequestLog.rawRequestContent()
.
-
requestContentPreview
void requestContentPreview(@Nullable String requestContentPreview)
Sets theRequestLog.requestContentPreview()
.
-
deferRequestContent
void deferRequestContent()
Allows therequestContent(Object, Object)
called afterendRequest()
. By default, ifrequestContent(Object, Object)
was not called yet,endRequest()
will callrequestContent(null, null)
automatically. This method turns off this default behavior. Note, however, this method will not preventendRequest(Throwable)
from callingrequestContent(null, null)
automatically.
-
isRequestContentDeferred
boolean isRequestContentDeferred()
Returnstrue
ifdeferRequestContent()
was ever called.
-
requestTrailers
void requestTrailers(HttpHeaders requestTrailers)
Sets theRequestLog.requestTrailers()
.
-
endRequest
void endRequest()
Finishes the collection of theRequest
information. This method sets the following properties:
-
endRequest
void endRequest(Throwable requestCause)
Finishes the collection of theRequest
information. This method sets the following properties:- Parameters:
requestCause
- the cause of the failure.
-
endRequest
void endRequest(long requestEndTimeNanos)
Finishes the collection of theRequest
information. This method sets the following properties:- Parameters:
requestEndTimeNanos
-System.nanoTime()
value when the request ended.
-
endRequest
void endRequest(Throwable requestCause, long requestEndTimeNanos)
Finishes the collection of theRequest
information. This method sets the following properties:- Parameters:
requestCause
- the cause of the failure.requestEndTimeNanos
-System.nanoTime()
value when the request ended.
-
startResponse
void startResponse()
Starts the collection ofResponse
information. This method sets the following properties:
-
startResponse
void startResponse(long responseStartTimeNanos, long responseStartTimeMicros)
Starts the collection ofResponse
information. This method sets the following properties:- Parameters:
responseStartTimeNanos
-System.nanoTime()
value when the response started.responseStartTimeMicros
- the number of microseconds since the epoch, e.g.System.currentTimeMillis() * 1000
.
-
increaseResponseLength
void increaseResponseLength(long deltaBytes)
Increases theRequestLog.responseLength()
bydeltaBytes
.
-
increaseResponseLength
void increaseResponseLength(HttpData data)
-
responseLength
void responseLength(long responseLength)
Sets theRequestLog.responseLength()
.
-
responseFirstBytesTransferred
void responseFirstBytesTransferred()
-
responseFirstBytesTransferred
void responseFirstBytesTransferred(long responseFirstBytesTransferredNanos)
SetsRequestLog.responseFirstBytesTransferredTimeNanos()
with the specified timestamp.
-
responseHeaders
void responseHeaders(ResponseHeaders responseHeaders)
Sets theRequestLog.responseHeaders()
.
-
responseContent
void responseContent(@Nullable Object responseContent, @Nullable Object rawResponseContent)
Sets theRequestLog.responseContent()
and theRequestLog.rawResponseContent()
.
-
responseContentPreview
void responseContentPreview(@Nullable String responseContentPreview)
Sets theRequestLog.responseContentPreview()
.
-
deferResponseContent
void deferResponseContent()
Allows theresponseContent(Object, Object)
called afterendResponse()
. By default, ifresponseContent(Object, Object)
was not called yet,endResponse()
will callresponseContent(null, null)
automatically. This method turns off this default behavior. Note, however, this method will not preventendResponse(Throwable)
from callingresponseContent(null, null)
automatically.
-
isResponseContentDeferred
boolean isResponseContentDeferred()
Returnstrue
ifdeferResponseContent()
was ever called.
-
responseTrailers
void responseTrailers(HttpHeaders responseTrailers)
Sets theRequestLog.responseTrailers()
.
-
endResponse
void endResponse()
Finishes the collection of theResponse
information. If aThrowable
cause has been set withresponseContent(Object, Object)
, it will be treated as theresponseCause
for this log. This method sets the following properties:
-
endResponse
void endResponse(Throwable responseCause)
Finishes the collection of theResponse
information. This method sets the following properties:- Parameters:
responseCause
- the cause of the failure.
-
endResponse
void endResponse(long responseEndTimeNanos)
Finishes the collection of theResponse
information. If aThrowable
cause has been set withresponseContent(Object, Object)
, it will be treated as theresponseCause
for this log. This method sets the following properties:- Parameters:
responseEndTimeNanos
-System.nanoTime()
value when the response ended.
-
endResponse
void endResponse(Throwable responseCause, long responseEndTimeNanos)
Finishes the collection of theResponse
information. This method sets the following properties:- Parameters:
responseCause
- the cause of the failure.responseEndTimeNanos
-System.nanoTime()
value when the response ended.
-
-