RequestFinishedInfo.Metrics

public abstract class RequestFinishedInfo.Metrics


Metrics collected for a single request. Most of these metrics are timestamps for events during the lifetime of the request, which can be used to build a detailed timeline for investigating performance.

Events happen in this order:

  1. request start
  2. DNS start
  3. DNS end
  4. connect start
  5. SSL start
  6. SSL end
  7. connect end
  8. sending start
  9. sending end
  10. response start
  11. request end
Start times are reported as the time when a request started blocking on event, not when the event actually occurred, with the exception of push start and end. If a metric is not meaningful or not available, including cases when a request finished before reaching that stage, start and end times will be null. If no time was spent blocking on an event, start and end will be the same time.

If the system clock is adjusted during the request, some of the java.util.Date values might not match it. Timestamps are recorded using a clock that is guaranteed not to run backwards. All timestamps are correct relative to the system clock at the time of request start, and taking the difference between two timestamps will give the correct difference between the events. In order to preserve this property, timestamps for events other than request start are not guaranteed to match the system clock at the times they represent.

Most timing metrics are taken from LoadTimingInfo, which holds the information for and .

Summary

Public constructors

Public methods

abstract @Nullable Date

Returns time when connection establishment finished.

abstract @Nullable Date

Returns time when connection establishment started.

abstract @Nullable Date

Returns time when DNS lookup finished.

abstract @Nullable Date

Returns time when DNS lookup started.

abstract @Nullable Date

Returns time when last byte of HTTP/2 server push was received.

abstract @Nullable Date

Returns time when first byte of HTTP/2 server push was received.

abstract @Nullable Long

Returns total bytes received over the network transport layer, or null if not collected.

abstract @Nullable Date

Returns time when the request finished.

abstract @Nullable Date

Returns time when the request started.

abstract @Nullable Date

Returns time when the end of the response headers was received.

abstract @Nullable Date

Returns time when sending the request finished.

abstract @Nullable Date

Returns time when sending the request started.

abstract @Nullable Long

Returns total bytes sent over the network transport layer, or null if not collected.

abstract boolean

Returns whether the socket was reused from a previous request.

abstract @Nullable Date

Returns time when SSL handshake finished.

abstract @Nullable Date

Returns time when SSL handshake started.

abstract @Nullable Long

Returns milliseconds between request initiation and finish, including a failure or cancellation, or null if not collected.

abstract @Nullable Long

Returns milliseconds between request initiation and first byte of response headers, or null if not collected.

Public constructors

Metrics

public Metrics()

Public methods

getConnectEnd

public abstract @Nullable Date getConnectEnd()

Returns time when connection establishment finished.

Returns
@Nullable Date

java.util.Date representing when connection establishment finished, after TCP connection is established and, if using HTTPS, SSL handshake is completed. For QUIC 0-RTT, this represents the time of handshake confirmation and might happen later than getSendingStart. null if the socket was reused (see getSocketReused).

getConnectStart

public abstract @Nullable Date getConnectStart()

Returns time when connection establishment started.

Returns
@Nullable Date

java.util.Date representing when connection establishment started, typically when DNS resolution finishes. null if the socket was reused (see getSocketReused).

getDnsEnd

public abstract @Nullable Date getDnsEnd()

Returns time when DNS lookup finished. This and getDnsStart will return non-null values regardless of whether the result came from a DNS server or the local cache.

Returns
@Nullable Date

java.util.Date representing when DNS lookup finished. null if the socket was reused (see getSocketReused).

getDnsStart

public abstract @Nullable Date getDnsStart()

Returns time when DNS lookup started. This and getDnsEnd will return non-null values regardless of whether the result came from a DNS server or the local cache.

Returns
@Nullable Date

java.util.Date representing when DNS lookup started. null if the socket was reused (see getSocketReused).

getPushEnd

public abstract @Nullable Date getPushEnd()

Returns time when last byte of HTTP/2 server push was received.

Returns
@Nullable Date

java.util.Date representing when the last byte of an HTTP/2 server push was received. null if server push is not used.

getPushStart

public abstract @Nullable Date getPushStart()

Returns time when first byte of HTTP/2 server push was received.

Returns
@Nullable Date

java.util.Date representing when the first byte of an HTTP/2 server push was received. null if server push is not used.

getReceivedByteCount

public abstract @Nullable Long getReceivedByteCount()

Returns total bytes received over the network transport layer, or null if not collected. Number of bytes does not include any previous redirects.

getRequestEnd

public abstract @Nullable Date getRequestEnd()

Returns time when the request finished.

Returns
@Nullable Date

java.util.Date representing when the request finished.

getRequestStart

public abstract @Nullable Date getRequestStart()

Returns time when the request started.

Returns
@Nullable Date

java.util.Date representing when the native request actually started. This timestamp will match the system clock at the time it represents.

getResponseStart

public abstract @Nullable Date getResponseStart()

Returns time when the end of the response headers was received.

Returns
@Nullable Date

java.util.Date representing when the end of the response headers was received.

getSendingEnd

public abstract @Nullable Date getSendingEnd()

Returns time when sending the request finished.

Returns
@Nullable Date

java.util.Date representing when sending HTTP request body finished. (Sending request body happens after sending request headers.)

getSendingStart

public abstract @Nullable Date getSendingStart()

Returns time when sending the request started.

Returns
@Nullable Date

java.util.Date representing when sending HTTP request headers started.

getSentByteCount

public abstract @Nullable Long getSentByteCount()

Returns total bytes sent over the network transport layer, or null if not collected.

getSocketReused

public abstract boolean getSocketReused()

Returns whether the socket was reused from a previous request. In HTTP/2 or QUIC, if streams are multiplexed in a single connection, returns true for all streams after the first.

Returns
boolean

whether this request reused a socket from a previous request. When true, DNS, connection, and SSL times will be null.

getSslEnd

public abstract @Nullable Date getSslEnd()

Returns time when SSL handshake finished. For QUIC, this will be the same time as getConnectEnd.

Returns
@Nullable Date

java.util.Date representing when SSL handshake finished. null if SSL is not used or if the socket was reused (see getSocketReused).

getSslStart

public abstract @Nullable Date getSslStart()

Returns time when SSL handshake started. For QUIC, this will be the same time as getConnectStart.

Returns
@Nullable Date

java.util.Date representing when SSL handshake started. null if SSL is not used or if the socket was reused (see getSocketReused).

getTotalTimeMs

public abstract @Nullable Long getTotalTimeMs()

Returns milliseconds between request initiation and finish, including a failure or cancellation, or null if not collected. TODO(mgersh): Remove once new API works http://crbug.com/629194

getTtfbMs

public abstract @Nullable Long getTtfbMs()

Returns milliseconds between request initiation and first byte of response headers, or null if not collected. TODO(mgersh): Remove once new API works http://crbug.com/629194