Class HttpRequestTiming
Captures the timing of a single HTTP request/response exchange handled by the proxy. Only populated (non-null on Timing) when EnableRequestTimingCapture is enabled; otherwise no instance is ever allocated and this class has zero impact on request handling.
All timestamps are UTC wall-clock instants captured with UtcNow, in the
order the proxy reaches each stage. The derived Duration/TimeToFirstByte properties
are simple differences between two such instants and are null until both of
their endpoints have been recorded - a session that never reaches a given stage (e.g. one
answered synthetically during BeforeRequest, before any upstream connection is ever
attempted, or one that fails before a response is received) simply leaves the later timestamps
null; nothing throws.
A request that is retried (a new upstream connection after RetryableServerConnectionException,
or a re-request after a 401/407 challenge) overwrites the connection/send/receive timestamps with
those of the latest attempt - AttemptCount tracks how many attempts were made in
total. TotalDuration and ClientRequestReadDuration are unaffected by
retries since they only depend on SessionCreatedAt.
Inherited Members
Namespace: Titanium.Web.Proxy.Diagnostics
Assembly: Titanium.Web.Proxy.dll
Syntax
public sealed class HttpRequestTiming
Properties
| Edit this page View SourceAttemptCount
Number of upstream-connection attempts made for this session so far. Starts at 0 and is
incremented every time a connection becomes ready (see ConnectionReadyAt) -
normally 1, higher only when a RetryableServerConnectionException forced a fresh
connection, or a 401/407 challenge triggered a re-request.
Declaration
public int AttemptCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
ClientRequestReadDuration
How long it took to read the request headers from the client, starting from when the request line first arrived.
Declaration
public TimeSpan? ClientRequestReadDuration { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
CompletedAt
When this session finished completely - after the response (headers and body, if any) was
delivered to the client and the AfterResponse event handler, if any, has returned. Also
marked for sessions that end via an unhandled exception or an early return (e.g. a denied/failed
request), so it always reflects when the session actually stopped, not just the success path.
Declaration
public DateTime? CompletedAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
ConnectionReadyAt
When an upstream connection became ready to use for the most recent attempt - either freshly established or retrieved from the connection pool. See UpstreamConnectionReused.
Declaration
public DateTime? ConnectionReadyAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
ConnectionWaitDuration
How long the proxy spent (running any BeforeRequest handler and) acquiring an upstream
connection for the most recent attempt, whether that meant establishing a fresh one or retrieving
one from the pool.
Declaration
public TimeSpan? ConnectionWaitDuration { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
IsComplete
true once CompletedAt has been recorded.
Declaration
public bool IsComplete { get; }
Property Value
| Type | Description |
|---|---|
| bool |
RequestHeadersReceivedAt
When the client's request headers were fully read, immediately before BeforeRequest is
invoked. null if the client disconnected while sending headers.
Declaration
public DateTime? RequestHeadersReceivedAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
RequestSendDuration
How long it took to write the request (headers and body, if any) to the upstream connection.
Declaration
public TimeSpan? RequestSendDuration { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
RequestSentAt
When the request (headers and, if any, body) finished being written to the upstream connection.
Declaration
public DateTime? RequestSentAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
ResponseDeliveryDuration
How long it took to deliver the response to the client after its headers were received from
upstream - this covers any BeforeResponse handler, writing the response headers/body
(which, for a streamed body, overlaps with still receiving that same body from the upstream
server - the two are not tracked separately), and any AfterResponse handler.
Declaration
public TimeSpan? ResponseDeliveryDuration { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
ResponseHeadersReceivedAt
When the response status line and headers were fully read from the upstream connection (i.e. time-to-first-byte of the final, non-interim response).
Declaration
public DateTime? ResponseHeadersReceivedAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
SessionCreatedAt
When the proxy created this session, immediately after accepting the request line from the client (before its headers are read).
Declaration
public DateTime SessionCreatedAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
TimeToFirstByte
Time-to-first-byte: how long the upstream server took to return response headers after the request was fully sent.
Declaration
public TimeSpan? TimeToFirstByte { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
TotalDuration
Total wall-clock duration of this session so far: from session creation through to CompletedAt once known, or through to now if the session is still in flight.
Declaration
public TimeSpan TotalDuration { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
UpstreamConnectionId
The Id of the upstream connection used for the most recent attempt, or null
if no connection has been acquired yet (e.g. the request was answered synthetically). Use together
with UpstreamConnectionTiming to inspect that
connection's own DNS/TCP/TLS establishment timing.
Declaration
public long? UpstreamConnectionId { get; }
Property Value
| Type | Description |
|---|---|
| long? |
UpstreamConnectionReused
true if the upstream connection for the most recent attempt was reused from the connection pool rather than freshly established.
Declaration
public bool UpstreamConnectionReused { get; }
Property Value
| Type | Description |
|---|---|
| bool |