Soup.MessageMetrics¶
Fields¶
None
Methods¶
|
|
|
|
|
|
Details¶
- class Soup.MessageMetrics¶
Contains metrics collected while loading a [class`Message`] either from the network or the disk cache.
Metrics are not collected by default for a [class`Message`], you need to add the flag
Soup.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 [class`Message`] is being loaded. You can connect to different [class`Message`] signals to get the final result of every value.
- copy()¶
- Returns:
a copy of self
- Return type:
Copies self.
- free()¶
Frees self.
- get_connect_end()¶
- Returns:
the connection end time
- Return type:
Get the time immediately after the [class`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()¶
- Returns:
the connection start time
- Return type:
Get the time immediately before the [class`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()¶
- Returns:
the domain lookup end time
- Return type:
Get the time immediately after the [class`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()¶
- Returns:
the domain lookup start time
- Return type:
Get the time immediately before the [class`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()¶
- Returns:
the fetch start time
- Return type:
Get the time immediately before the [class`Message`] started to fetch a resource either from a remote server or local disk cache.
- get_request_body_bytes_sent()¶
- Returns:
the request body bytes sent
- Return type:
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 [method`MessageMetrics`.get_request_body_size]. This value is available right before [signal`Message`:py:func:::wrote-body<Soup.MessageMetrics.signals.wrote_body>] signal is emitted, but you might get an intermediate value if called before.
- get_request_body_size()¶
- Returns:
the request body size
- Return type:
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 [signal`Message`:py:func:::wrote-body<Soup.MessageMetrics.signals.wrote_body>] signal is emitted, but you might get an intermediate value if called before.
- get_request_header_bytes_sent()¶
- Returns:
the request headers bytes sent
- Return type:
Get the number of bytes sent to the network for the request headers.
This value is available right before [signal`Message`:py:func:::wrote-headers<Soup.MessageMetrics.signals.wrote_headers>] signal is emitted, but you might get an intermediate value if called before.
- get_request_start()¶
- Returns:
the request start time
- Return type:
Get the time immediately before the [class`Message`] started the request of the resource from the server or the local disk cache.
- get_response_body_bytes_received()¶
- Returns:
the response body bytes received
- Return type:
Get the number of bytes received from the network for the response body.
This value is available right before [signal`Message`:py:func:::got-body<Soup.MessageMetrics.signals.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()¶
- Returns:
the response body size
- Return type:
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 [method`MessageMetrics`.get_response_body_bytes_received]. This value is available right before [signal`Message`:py:func:::got-body<Soup.MessageMetrics.signals.got_body>] signal is emitted, but you might get an intermediate value if called before.
- get_response_end()¶
- Returns:
the response end time
- Return type:
Get the time immediately after the [class`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()¶
- Returns:
the response headers bytes received
- Return type:
Get the number of bytes received from the network for the response headers.
This value is available right before [signal`Message`:py:func:::got-headers<Soup.MessageMetrics.signals.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.
- get_response_start()¶
- Returns:
the response start time
- Return type:
Get the time immediately after the [class`Message`] received the first bytes of the response from the server or the local disk cache.
- get_tls_start()¶
- Returns:
the tls start time
- Return type:
Get the time immediately before the [class`Message`] 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).