Interface RequestOnlyLog
- All Superinterfaces:
RequestLogAccess
- All Known Subinterfaces:
RequestLog
A set of informational properties for request-side only, collected while consuming a
Request
.-
Method Summary
Modifier and TypeMethodDescriptionReturns the authenticated user which is used to print%u
format of an access log.@Nullable io.netty.channel.Channel
channel()
Returns the NettyChannel
which handled theRequest
.Returns theClientConnectionTimings
of theRequest
.fullName()
Returns the human-readable full name, which is the concatenation ofserviceName()
andname()
using'/'
, of theRequest
.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.Returns the low-level content object of theRequest
, which is specific to theSerializationFormat
.Returns the cause of request processing failure.Returns the high-level content object of theRequest
, which is specific to theSerializationFormat
.Returns the preview of request content of theRequest
.default long
Returns the duration that was taken to consume or produce the request completely, in nanoseconds.long
Returns the time when the processing of the request finished, in nanoseconds.Returns the time when the first bytes of the request headers were transferred over the wire.Returns theRequestHeaders
.long
Returns the length of the request content.long
Returns the time when the processing of the request started, in microseconds since the epoch.long
Returns the time when the processing of the request started, in milliseconds since the epoch.long
Returns the time when the processing of the request started, in nanoseconds.Returns the HTTP trailers of theRequest
.scheme()
Returns theSerializationFormat
of theRequest
.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.Returns theSessionProtocol
of theRequest
.Returns theSSLSession
of the connection which handled theRequest
.default String
Deprecated.default String
toStringRequestOnly
(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.UseLogFormatter.formatRequest(RequestOnlyLog)
instead.default String
toStringRequestOnly
(BiFunction<? super RequestContext, ? super RequestHeaders, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer, BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> trailersSanitizer) Deprecated.UseLogFormatter.formatRequest(RequestOnlyLog)
instead.Methods inherited from interface com.linecorp.armeria.common.logging.RequestLogAccess
availabilityStamp, children, context, ensureAvailable, ensureAvailable, ensureAvailable, ensureComplete, ensureRequestComplete, getIfAvailable, getIfAvailable, 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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
requestLength
long requestLength()Returns the length of the request content.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
-
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:
-
channel
Returns the NettyChannel
which handled theRequest
.- 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:
-
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:
-
sessionProtocol
SessionProtocol sessionProtocol()Returns theSessionProtocol
of theRequest
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
-
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:
-
serializationFormat
SerializationFormat serializationFormat()Returns theSerializationFormat
of theRequest
. -
scheme
Scheme scheme()- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
-
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. -
authenticatedUser
Returns the authenticated user which is used to print%u
format of an access log.- See Also:
-
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:
-
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:
-
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:
-
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:
-
requestTrailers
HttpHeaders requestTrailers()Returns the HTTP trailers of theRequest
.- Throws:
RequestLogAvailabilityException
- if the property is not available yet.- See Also:
-
toStringRequestOnly
Deprecated.UseLogFormatter.formatRequest(RequestOnlyLog)
instead.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
@Deprecated default String toStringRequestOnly(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Deprecated.UseLogFormatter.formatRequest(RequestOnlyLog)
instead.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
@Deprecated default String toStringRequestOnly(BiFunction<? super RequestContext, ? super RequestHeaders, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer, BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> trailersSanitizer) Deprecated.UseLogFormatter.formatRequest(RequestOnlyLog)
instead.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.
-
LogFormatter.formatRequest(RequestOnlyLog)
instead.