Interface RequestOnlyLog
- All Superinterfaces:
RequestLogAccess
- All Known Subinterfaces:
RequestLog
public interface RequestOnlyLog extends RequestLogAccess
A set of informational properties for request-side only, collected while consuming a
Request
.-
Method Summary
Modifier and Type Method Description Channel
channel()
ClientConnectionTimings
connectionTimings()
Returns theClientConnectionTimings
of theRequest
.String
fullName()
Returns the human-readable full name, which is the concatenation ofserviceName()
andname()
using'/'
, of theRequest
.String
name()
Returns the human-readable simple name of theRequest
, such as: gRPC - A capitalized method name defined inio.grpc.MethodDescriptor
(e.g,GetItems
) Thrift and annotated service - a method name (e.g,getItems
)HttpService
- an HTTP method name This property is often used as a meter tag or distributed trace's span name.Object
rawRequestContent()
Returns the low-level content object of theRequest
, which is specific to theSerializationFormat
.Throwable
requestCause()
Returns the cause of request processing failure.Object
requestContent()
Returns the high-level content object of theRequest
, which is specific to theSerializationFormat
.String
requestContentPreview()
Returns the preview of request content of theRequest
.default long
requestDurationNanos()
Returns the duration that was taken to consume or produce the request completely, in nanoseconds.long
requestEndTimeNanos()
Returns the time when the processing of the request finished, in nanoseconds.Long
requestFirstBytesTransferredTimeNanos()
Returns the time when the first bytes of the request headers were transferred over the wire.RequestHeaders
requestHeaders()
Returns theRequestHeaders
.long
requestLength()
Returns the length of the request content.long
requestStartTimeMicros()
Returns the time when the processing of the request started, in microseconds since the epoch.long
requestStartTimeMillis()
Returns the time when the processing of the request started, in milliseconds since the epoch.long
requestStartTimeNanos()
Returns the time when the processing of the request started, in nanoseconds.HttpHeaders
requestTrailers()
Returns the HTTP trailers of theRequest
.Scheme
scheme()
SerializationFormat
serializationFormat()
Returns theSerializationFormat
of theRequest
.String
serviceName()
Returns the human-readable name of the service that served theRequest
, such as: gRPC - a service name (e.g,com.foo.GrpcService
) Thrift - a service type (e.g,com.foo.ThriftService$AsyncIface
orcom.foo.ThriftService$Iface
)HttpService
and annotated service - an innermost class name This property is often used as a meter tag or distributed trace's span name.SessionProtocol
sessionProtocol()
Returns theSessionProtocol
of theRequest
.SSLSession
sslSession()
Returns theSSLSession
of the connection which handled theRequest
.default String
toStringRequestOnly()
Returns the string representation of theRequest
, with no sanitization of headers or content.default String
toStringRequestOnly(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer, BiFunction<? super RequestContext,Object,?> contentSanitizer)
Returns the string representation of theRequest
.String
toStringRequestOnly(BiFunction<? super RequestContext,? super RequestHeaders,?> headersSanitizer, BiFunction<? super RequestContext,Object,?> contentSanitizer, BiFunction<? super RequestContext,? super HttpHeaders,?> trailersSanitizer)
Returns the string representation of theRequest
.Methods inherited from interface com.linecorp.armeria.common.logging.RequestLogAccess
availabilityStamp, children, context, ensureAvailable, ensureAvailable, ensureAvailable, ensureComplete, ensureRequestComplete, isAvailable, isAvailable, isAvailable, isComplete, isRequestComplete, parent, partial, whenAvailable, whenAvailable, whenAvailable, whenComplete, whenRequestComplete
-
Method Details
-
requestStartTimeMicros
long requestStartTimeMicros()Returns the time when the processing of the request started, in microseconds since the epoch.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_START_TIME
-
requestStartTimeMillis
long requestStartTimeMillis()Returns the time when the processing of the request started, in milliseconds since the epoch.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_START_TIME
-
requestStartTimeNanos
long requestStartTimeNanos()Returns the time when the processing of the request started, in nanoseconds. This value can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_START_TIME
-
requestFirstBytesTransferredTimeNanos
Returns the time when the first bytes of the request headers were transferred over the wire. For a client, this is the time the client sent the data, while for a server it is the time the server received them. This value can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.- Returns:
- the transfer time, or
null
if nothing was transferred. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_FIRST_BYTES_TRANSFERRED_TIME
-
requestEndTimeNanos
long requestEndTimeNanos()Returns the time when the processing of the request finished, in nanoseconds. This value can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_END_TIME
-
requestDurationNanos
default long requestDurationNanos()Returns the duration that was taken to consume or produce the request completely, in nanoseconds.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_END_TIME
-
requestLength
long requestLength()Returns the length of the request content.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_LENGTH
-
requestCause
Returns the cause of request processing failure.- Returns:
- the cause, or
null
if the request was processed completely. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_CAUSE
-
channel
- Returns:
- the Netty
Channel
, ornull
if theRequest
has failed even before a connection is established. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.SESSION
-
sslSession
Returns theSSLSession
of the connection which handled theRequest
.- Returns:
- the
SSLSession
, ornull
if theRequest
has failed even before a TLS connection is established or the connection does not use TLS. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.SESSION
-
sessionProtocol
SessionProtocol sessionProtocol()Returns theSessionProtocol
of theRequest
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.SESSION
-
connectionTimings
Returns theClientConnectionTimings
of theRequest
.- Returns:
- the
ClientConnectionTimings
if theRequest
involved a new connection attempt, ornull
otherwise. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.SESSION
-
serializationFormat
SerializationFormat serializationFormat()Returns theSerializationFormat
of theRequest
. -
scheme
Scheme scheme()- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.SCHEME
-
serviceName
Returns the human-readable name of the service that served theRequest
, such as:- gRPC - a service name (e.g,
com.foo.GrpcService
) - Thrift - a service type (e.g,
com.foo.ThriftService$AsyncIface
orcom.foo.ThriftService$Iface
) HttpService
and annotated service - an innermost class name
- gRPC - a service name (e.g,
-
name
String name()Returns the human-readable simple name of theRequest
, such as:- gRPC - A capitalized method name defined in
io.grpc.MethodDescriptor
(e.g,GetItems
) - Thrift and annotated service - a method name (e.g,
getItems
) HttpService
- an HTTP method name
- gRPC - A capitalized method name defined in
-
fullName
String fullName()Returns the human-readable full name, which is the concatenation ofserviceName()
andname()
using'/'
, of theRequest
. This property is often used as a meter tag or distributed trace's span name. -
requestHeaders
RequestHeaders requestHeaders()Returns theRequestHeaders
. If theRequest
was not received or sent at all, it will return a dummyRequestHeaders
whose:authority
and:path
are set to"?"
,:scheme
is set to"http"
or"https"
, and:method
is set to"UNKNOWN"
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_HEADERS
-
requestContent
Returns the high-level content object of theRequest
, which is specific to theSerializationFormat
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_CONTENT
-
rawRequestContent
Returns the low-level content object of theRequest
, which is specific to theSerializationFormat
.- Returns:
ThriftCall
for Thrift, ornull
for others- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_CONTENT
-
requestContentPreview
Returns the preview of request content of theRequest
. Note that aService
or aClient
must be decorated withContentPreviewingService
orContentPreviewingClient
decorators respectively to enable the content preview.- Returns:
- the preview, or
null
if the preview is disabled. - Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_CONTENT_PREVIEW
-
requestTrailers
HttpHeaders requestTrailers()Returns the HTTP trailers of theRequest
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
RequestLogProperty.REQUEST_TRAILERS
-
toStringRequestOnly
Returns the string representation of theRequest
, with no sanitization of headers or content. This method is a shortcut for:toStringRequestOnly((ctx, headers) -> headers, (ctx, content) -> content, (ctx, trailers) -> trailers);
-
toStringRequestOnly
default String toStringRequestOnly(BiFunction<? super RequestContext,? super HttpHeaders,?> headersSanitizer, BiFunction<? super RequestContext,Object,?> contentSanitizer)Returns the string representation of theRequest
. This method is a shortcut for:toStringRequestOnly(headersSanitizer, contentSanitizer, headersSanitizer);
- Parameters:
headersSanitizer
- aBiFunction
for sanitizing HTTP headers for logging. The result of theBiFunction
is what is actually logged as headers.contentSanitizer
- aBiFunction
for sanitizing request content for logging. The result of theBiFunction
is what is actually logged as content.
-
toStringRequestOnly
String toStringRequestOnly(BiFunction<? super RequestContext,? super RequestHeaders,?> headersSanitizer, BiFunction<? super RequestContext,Object,?> contentSanitizer, BiFunction<? super RequestContext,? super HttpHeaders,?> trailersSanitizer)Returns the string representation of theRequest
.- Parameters:
headersSanitizer
- aBiFunction
for sanitizing HTTP headers for logging. The result of theBiFunction
is what is actually logged as headers.contentSanitizer
- aFunction
for sanitizing request content for logging. The result of theBiFunction
is what is actually logged as content.trailersSanitizer
- aBiFunction
for sanitizing HTTP trailers for logging. The result of theBiFunction
is what is actually logged as trailers.
-