MessageMetrics#
- class MessageMetrics(*args, **kwargs)#
Contains metrics collected while loading a Message
either from the
network or the disk cache.
Metrics are not collected by default for a Message
, you need to add the
flag 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.
Methods#
- class MessageMetrics
-
- get_connect_end() int #
Get the time immediately after the
Message
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).
- get_connect_start() int #
Get the time immediately before the
Message
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).
- get_dns_end() int #
Get the time immediately after the
Message
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).
- get_dns_start() int #
Get the time immediately before the
Message
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).
- get_fetch_start() int #
Get the time immediately before the
Message
started to fetch a resource either from a remote server or local disk cache.
- get_request_body_bytes_sent() int #
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
get_request_body_size
. This value is available right beforewrote_body
signal is emitted, but you might get an intermediate value if called before.
- get_request_body_size() int #
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
wrote_body
signal is emitted, but you might get an intermediate value if called before.
- get_request_header_bytes_sent() int #
Get the number of bytes sent to the network for the request headers.
This value is available right before
wrote_headers
signal is emitted, but you might get an intermediate value if called before.
- get_request_start() int #
Get the time immediately before the
Message
started the request of the resource from the server or the local disk cache.
- get_response_body_bytes_received() int #
Get the number of bytes received from the network for the response body.
This value is available right before
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.
- get_response_body_size() int #
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
get_response_body_bytes_received
. This value is available right beforegot_body
signal is emitted, but you might get an intermediate value if called before.
- get_response_end() int #
Get the time immediately after the
Message
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.
- get_response_header_bytes_received() int #
Get the number of bytes received from the network for the response headers.
This value is available right before
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.