Class MessageMetrics
- All Implemented Interfaces:
Proxy
Message
either from the
network or the disk cache.
Metrics are not collected by default for a Message
, you need to add the
flag MessageFlags.COLLECT_METRICS
to enable the feature.
Temporal metrics are expressed as a monotonic time and always start with a fetch start event and finish with response end. All other events are optional. An event can be 0 because it hasn't happened yet, because it's optional or because the load failed before the event reached.
Size metrics are expressed in bytes and are updated while the Message
is
being loaded. You can connect to different Message
signals to get the
final result of every value.
-
Constructor Summary
ConstructorDescriptionMessageMetrics
(MemorySegment address) Create a MessageMetrics proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies this MessageMetrics.void
free()
Frees this MessageMetrics.long
Get the time immediately after theMessage
completed the connection to the server.long
Get the time immediately before theMessage
started to establish the connection to the server.long
Get the time immediately after theMessage
completed the domain lookup name for the resource.long
Get the time immediately before theMessage
started the domain lookup name for the resource.long
Get the time immediately before theMessage
started to fetch a resource either from a remote server or local disk cache.long
Get the number of bytes sent to the network for the request body.long
Get the request body size in bytes.long
Get the number of bytes sent to the network for the request headers.long
Get the time immediately before theMessage
started the request of the resource from the server or the local disk cache.long
Get the number of bytes received from the network for the response body.long
Get the response body size in bytes.long
Get the time immediately after theMessage
received the last bytes of the response from the server or the local disk cache.long
Get the number of bytes received from the network for the response headers.long
Get the time immediately after theMessage
received the first bytes of the response from the server or the local disk cache.long
Get the time immediately before theMessage
started the TLS handshake.static Type
getType()
Get the GType of the MessageMetrics classMethods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
MessageMetrics
Create a MessageMetrics proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
copy
-
free
public void free()Frees this MessageMetrics. -
getConnectEnd
public long getConnectEnd()Get the time immediately after theMessage
completed the connection to the server. This includes the time for the proxy negotiation and TLS handshake.It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).
- Returns:
- the connection end time
-
getConnectStart
public long getConnectStart()Get the time immediately before theMessage
started to establish the connection to the server.It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).
- Returns:
- the connection start time
-
getDnsEnd
public long getDnsEnd()Get the time immediately after theMessage
completed the domain lookup name for the resource.It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).
- Returns:
- the domain lookup end time
-
getDnsStart
public long getDnsStart()Get the time immediately before theMessage
started the domain lookup name for the resource.It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).
- Returns:
- the domain lookup start time
-
getFetchStart
public long getFetchStart()Get the time immediately before theMessage
started to fetch a resource either from a remote server or local disk cache.- Returns:
- the fetch start time
-
getRequestBodyBytesSent
public long getRequestBodyBytesSent()Get the number of bytes sent to the network for the request body.This is the size of the body sent, after encodings are applied, so it might be greater than the value returned by
getRequestBodySize()
. This value is available right beforeMessage::wrote-body
signal is emitted, but you might get an intermediate value if called before.- Returns:
- the request body bytes sent
-
getRequestBodySize
public long getRequestBodySize()Get the request body size in bytes. This is the size of the original body given to the request before any encoding is applied.This value is available right before
Message::wrote-body
signal is emitted, but you might get an intermediate value if called before.- Returns:
- the request body size
-
getRequestHeaderBytesSent
public long getRequestHeaderBytesSent()Get the number of bytes sent to the network for the request headers.This value is available right before
Message::wrote-headers
signal is emitted, but you might get an intermediate value if called before.- Returns:
- the request headers bytes sent
-
getRequestStart
public long getRequestStart()Get the time immediately before theMessage
started the request of the resource from the server or the local disk cache.- Returns:
- the request start time
-
getResponseBodyBytesReceived
public long getResponseBodyBytesReceived()Get the number of bytes received from the network for the response body.This value is available right before
Message::got-body
signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0.- Returns:
- the response body bytes received
-
getResponseBodySize
public long getResponseBodySize()Get the response body size in bytes.This is the size of the body as given to the user after all encodings are applied, so it might be greater than the value returned by
getResponseBodyBytesReceived()
. This value is available right beforeMessage::got-body
signal is emitted, but you might get an intermediate value if called before.- Returns:
- the response body size
-
getResponseEnd
public long getResponseEnd()Get the time immediately after theMessage
received the last bytes of the response from the server or the local disk cache.In case of load failure, this returns the time immediately before the fetch is aborted.
- Returns:
- the response end time
-
getResponseHeaderBytesReceived
public long getResponseHeaderBytesReceived()Get the number of bytes received from the network for the response headers.This value is available right before
Message::got-headers
signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0.- Returns:
- the response headers bytes received
-
getResponseStart
public long getResponseStart()Get the time immediately after theMessage
received the first bytes of the response from the server or the local disk cache.- Returns:
- the response start time
-
getTlsStart
public long getTlsStart()Get the time immediately before theMessage
started the TLS handshake.It will be 0 if no TLS handshake was required to fetch the resource (connection was not secure, a persistent connection was used or resource was loaded from the local disk cache).
- Returns:
- the tls start time
-