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%uformat of an access log.channel()Returns theClientConnectionTimingsof 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 longReturns the duration that was taken to consume or produce the request completely, in nanoseconds.longReturns 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.longReturns the length of the request content.longReturns the time when the processing of the request started, in microseconds since the epoch.longReturns the time when the processing of the request started, in milliseconds since the epoch.longReturns the time when the processing of the request started, in nanoseconds.Returns the HTTP trailers of theRequest.scheme()Returns theSerializationFormatof 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$AsyncIfaceorcom.foo.ThriftService$Iface)HttpServiceand annotated service - an innermost class name This property is often used as a meter tag or distributed trace's span name.Returns theSessionProtocolof theRequest.Returns theSSLSessionof the connection which handled theRequest.default StringReturns the string representation of theRequest, with no sanitization of headers or content.default StringtoStringRequestOnly(BiFunction<? super RequestContext, ? super HttpHeaders, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Returns the string representation of theRequest.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) 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:
-
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
nullif 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
nullif the request was processed completely. - Throws:
RequestLogAvailabilityException- if the property is not available yet.- See Also:
-
channel
- Returns:
- the Netty
Channel, ornullif theRequesthas failed even before a connection is established. - Throws:
RequestLogAvailabilityException- if the property is not available yet.- See Also:
-
sslSession
Returns theSSLSessionof the connection which handled theRequest.- Returns:
- the
SSLSession, ornullif theRequesthas 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 theSessionProtocolof theRequest.- Throws:
RequestLogAvailabilityException- if the property is not available yet.- See Also:
-
connectionTimings
Returns theClientConnectionTimingsof theRequest.- Returns:
- the
ClientConnectionTimingsif theRequestinvolved a new connection attempt, ornullotherwise. - Throws:
RequestLogAvailabilityException- if the property is not available yet.- See Also:
-
serializationFormat
SerializationFormat serializationFormat()Returns theSerializationFormatof 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$AsyncIfaceorcom.foo.ThriftService$Iface) HttpServiceand 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%uformat of an access log.- See Also:
-
requestHeaders
RequestHeaders requestHeaders()Returns theRequestHeaders. If theRequestwas not received or sent at all, it will return a dummyRequestHeaderswhose:authorityand:pathare set to"?",:schemeis set to"http"or"https", and:methodis 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:
ThriftCallfor Thrift, ornullfor others- Throws:
RequestLogAvailabilityException- if the property is not available yet.- See Also:
-
requestContentPreview
Returns the preview of request content of theRequest. Note that aServiceor aClientmust be decorated withContentPreviewingServiceorContentPreviewingClientdecorators respectively to enable the content preview.- Returns:
- the preview, or
nullif 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
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, ? extends @Nullable Object> headersSanitizer, BiFunction<? super RequestContext, Object, ? extends @Nullable Object> contentSanitizer) Returns the string representation of theRequest. This method is a shortcut for:toStringRequestOnly(headersSanitizer, contentSanitizer, headersSanitizer);- Parameters:
headersSanitizer- aBiFunctionfor sanitizing HTTP headers for logging. The result of theBiFunctionis what is actually logged as headers.contentSanitizer- aBiFunctionfor sanitizing request content for logging. The result of theBiFunctionis what is actually logged as content.
-
toStringRequestOnly
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) Returns the string representation of theRequest.- Parameters:
headersSanitizer- aBiFunctionfor sanitizing HTTP headers for logging. The result of theBiFunctionis what is actually logged as headers.contentSanitizer- aFunctionfor sanitizing request content for logging. The result of theBiFunctionis what is actually logged as content.trailersSanitizer- aBiFunctionfor sanitizing HTTP trailers for logging. The result of theBiFunctionis what is actually logged as trailers.
-