Package org.microproxy
Record Class FlowTimings
java.lang.Object
java.lang.Record
org.microproxy.FlowTimings
- Record Components:
startEpochMillis- wall-clock time when the request started arriving; 0 forNONEdnsStartNanos- the DNS lookup start offset in nanoseconds, or -1 if absentdnsEndNanos- the DNS lookup end offset in nanoseconds, or -1 if absentconnectStartNanos- the TCP connect start offset in nanoseconds, or -1 if absentconnectEndNanos- the TCP connect end offset in nanoseconds, or -1 if absenttlsStartNanos- the upstream TLS start offset in nanoseconds, or -1 if absenttlsEndNanos- the upstream TLS end offset in nanoseconds, or -1 if absentrequestSentNanos- the completed request-send offset in nanoseconds, or -1 if absentfirstResponseByteNanos- the first upstream response-byte offset in nanoseconds, or -1 if absentresponseCompleteNanos- the completed client-response offset in nanoseconds, or -1 if absentclientTlsHandshakeNanos- the client TLS handshake duration in nanoseconds, or -1 if absent
public record FlowTimings(long startEpochMillis, long dnsStartNanos, long dnsEndNanos, long connectStartNanos, long connectEndNanos, long tlsStartNanos, long tlsEndNanos, long requestSentNanos, long firstResponseByteNanos, long responseCompleteNanos, long clientTlsHandshakeNanos)
extends Record
When the phases of one request/response exchange happened, from
FlowContext.timings().
Every ...Nanos component except clientTlsHandshakeNanos is an offset in
nanoseconds (System.nanoTime()) from the moment the first byte of the request arrived,
or -1 when that phase did not happen (yet). A request on a reused keep-alive or pooled
server connection has no DNS, connect or TLS phase; a request answered by the proxy or a filter
has no server phases at all. When several connection attempts were made (falling back from one
chained proxy to the next), a phase starts with the first attempt and ends with the last.
Phases with the server:
- DNS: resolving the server's name (or a chained proxy's), unless a filter supplied an address;
- connect: the TCP connection to the server or first chained proxy;
- TLS: handshakes towards the server: with a TLS chained proxy, and with the origin when
intercepting (
CONNECTwith aMitmManager, where it is part of theCONNECTexchange, not of the requests inside the session); - request sent: the request head and body have been written;
- first response byte: the first byte of the server's response (including a
1xx); - response complete: the last byte of the response to the client has been written, whoever made the response.
clientTlsHandshakeNanos is the duration of the TLS handshake with the client (the
proxy's TLS listener, or the intercepted session) on which the request arrived, or -1.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FlowTimingsNo exchange recorded, e.g. for a context made outside the proxy. -
Constructor Summary
ConstructorsConstructorDescriptionFlowTimings(long startEpochMillis, long dnsStartNanos, long dnsEndNanos, long connectStartNanos, long connectEndNanos, long tlsStartNanos, long tlsEndNanos, long requestSentNanos, long firstResponseByteNanos, long responseCompleteNanos, long clientTlsHandshakeNanos) Creates an instance of aFlowTimingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionHow long the TLS handshake with the client took.longReturns the value of theclientTlsHandshakeNanosrecord component.connect()How long the TCP connect took.longReturns the value of theconnectEndNanosrecord component.longReturns the value of theconnectStartNanosrecord component.longReturns the value of thednsEndNanosrecord component.How long resolving the server's name took.longReturns the value of thednsStartNanosrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefirstResponseByteNanosrecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of therequestSentNanosrecord component.longReturns the value of theresponseCompleteNanosrecord component.start()When the request started arriving (wall clock).longReturns the value of thestartEpochMillisrecord component.From the start of the request to the first byte of the server's response: everything the client waited for that the proxy did not decide alone (lookup, connect, sending, the server).longReturns the value of thetlsEndNanosrecord component.How long the TLS handshakes towards the server took.longReturns the value of thetlsStartNanosrecord component.final StringtoString()Returns a string representation of this record class.total()From the start of the request to the end of the response sent to the client.
-
Field Details
-
NONE
No exchange recorded, e.g. for a context made outside the proxy.
-
-
Constructor Details
-
FlowTimings
public FlowTimings(long startEpochMillis, long dnsStartNanos, long dnsEndNanos, long connectStartNanos, long connectEndNanos, long tlsStartNanos, long tlsEndNanos, long requestSentNanos, long firstResponseByteNanos, long responseCompleteNanos, long clientTlsHandshakeNanos) Creates an instance of aFlowTimingsrecord class.- Parameters:
startEpochMillis- the value for thestartEpochMillisrecord componentdnsStartNanos- the value for thednsStartNanosrecord componentdnsEndNanos- the value for thednsEndNanosrecord componentconnectStartNanos- the value for theconnectStartNanosrecord componentconnectEndNanos- the value for theconnectEndNanosrecord componenttlsStartNanos- the value for thetlsStartNanosrecord componenttlsEndNanos- the value for thetlsEndNanosrecord componentrequestSentNanos- the value for therequestSentNanosrecord componentfirstResponseByteNanos- the value for thefirstResponseByteNanosrecord componentresponseCompleteNanos- the value for theresponseCompleteNanosrecord componentclientTlsHandshakeNanos- the value for theclientTlsHandshakeNanosrecord component
-
-
Method Details
-
start
When the request started arriving (wall clock).- Returns:
- the request start instant, or empty if no exchange was recorded
-
dnsLookup
How long resolving the server's name took.- Returns:
- the DNS lookup duration, or empty if the phase was not recorded
-
connect
How long the TCP connect took.- Returns:
- the TCP connect duration, or empty if the phase was not recorded
-
tlsHandshake
How long the TLS handshakes towards the server took.- Returns:
- the upstream TLS duration, or empty if the phase was not recorded
-
clientTlsHandshake
How long the TLS handshake with the client took.- Returns:
- the client TLS duration, or empty if the phase was not recorded
-
timeToFirstByte
From the start of the request to the first byte of the server's response: everything the client waited for that the proxy did not decide alone (lookup, connect, sending, the server).- Returns:
- the time to the first upstream byte, or empty if none was recorded
-
total
From the start of the request to the end of the response sent to the client.- Returns:
- the full exchange duration, or empty until the response completes
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
startEpochMillis
public long startEpochMillis()Returns the value of thestartEpochMillisrecord component.- Returns:
- the value of the
startEpochMillisrecord component
-
dnsStartNanos
public long dnsStartNanos()Returns the value of thednsStartNanosrecord component.- Returns:
- the value of the
dnsStartNanosrecord component
-
dnsEndNanos
public long dnsEndNanos()Returns the value of thednsEndNanosrecord component.- Returns:
- the value of the
dnsEndNanosrecord component
-
connectStartNanos
public long connectStartNanos()Returns the value of theconnectStartNanosrecord component.- Returns:
- the value of the
connectStartNanosrecord component
-
connectEndNanos
public long connectEndNanos()Returns the value of theconnectEndNanosrecord component.- Returns:
- the value of the
connectEndNanosrecord component
-
tlsStartNanos
public long tlsStartNanos()Returns the value of thetlsStartNanosrecord component.- Returns:
- the value of the
tlsStartNanosrecord component
-
tlsEndNanos
public long tlsEndNanos()Returns the value of thetlsEndNanosrecord component.- Returns:
- the value of the
tlsEndNanosrecord component
-
requestSentNanos
public long requestSentNanos()Returns the value of therequestSentNanosrecord component.- Returns:
- the value of the
requestSentNanosrecord component
-
firstResponseByteNanos
public long firstResponseByteNanos()Returns the value of thefirstResponseByteNanosrecord component.- Returns:
- the value of the
firstResponseByteNanosrecord component
-
responseCompleteNanos
public long responseCompleteNanos()Returns the value of theresponseCompleteNanosrecord component.- Returns:
- the value of the
responseCompleteNanosrecord component
-
clientTlsHandshakeNanos
public long clientTlsHandshakeNanos()Returns the value of theclientTlsHandshakeNanosrecord component.- Returns:
- the value of the
clientTlsHandshakeNanosrecord component
-