[]previous and next page

RequestTimings

What the onTimings hook learns about one finished request.

What the onTimings hook learns about one finished request. Durations are milliseconds from performance.now().

Import#

ts
import type { RequestTimings } from "@shadow-js/dusk/server";

Signature#

ts
interface RequestTimings {
  /** The request id (the `x-request-id` header). */
  readonly requestId: string;
  readonly method: string;
  /** The URL path of the request. */
  readonly path: string;
  /** The matched route pattern (`/posts/:id`), or `undefined` when no route matched. */
  readonly route: string | undefined;
  /** The final status code. */
  readonly status: number;
  /** Time to the response head: what the `total` entry of the header holds. */
  readonly totalMs: number;
  /** Time until the route was resolved (`undefined` when the request ended before that). */
  readonly routeMs: number | undefined;
  /** The route loader chain (`undefined` for a request that ran none). */
  readonly loadersMs: number | undefined;
  /** The render up to the shell (`undefined` for a request that rendered no page). */
  readonly renderMs: number | undefined;
  /**
   * Time until the response body ended, for a streamed page: the full render time. `undefined` for any other
   * response and for a stream the client canceled.
   */
  readonly streamMs: number | undefined;
  /** True when the response body did not finish: the client disconnected or the request timed out. */
  readonly aborted: boolean;
  /** Your metrics (`event.timing`), in the order first recorded. */
  readonly metrics: readonly {
    readonly name: string;
    readonly durationMs: number;
    readonly description: string | undefined;
  }[];
}

Members#

Name Type Description
requestId readonly requestId: string The request id (the x-request-id header).
method readonly method: string
path readonly path: string The URL path of the request.
route readonly route: string | undefined The matched route pattern (/posts/:id), or undefined when no route matched.
status readonly status: number The final status code.
totalMs readonly totalMs: number Time to the response head: what the total entry of the header holds.
routeMs readonly routeMs: number | undefined Time until the route was resolved (undefined when the request ended before that).
loadersMs readonly loadersMs: number | undefined The route loader chain (undefined for a request that ran none).
renderMs readonly renderMs: number | undefined The render up to the shell (undefined for a request that rendered no page).
streamMs readonly streamMs: number | undefined Time until the response body ended, for a streamed page: the full render time. undefined for any other response and for a stream the client canceled.
aborted readonly aborted: boolean True when the response body did not finish: the client disconnected or the request timed out.
metrics readonly metrics: readonly { readonly name: string; readonly durationMs: number; readonly description: string | undefined; }[] Your metrics (event.timing), in the order first recorded.