@sentry/node
Version:
Sentry Node SDK using OpenTelemetry for performance instrumentation
28 lines • 1.5 kB
TypeScript
import type { Client } from '@sentry/core';
interface HttpServerResponse {
headersSent: boolean;
getHeader(name: string): number | string | string[] | undefined;
setHeader(name: string, value: string): unknown;
writeHead(...args: unknown[]): unknown;
}
type HeaderObject = Record<string, unknown>;
/**
* Sends the trace of the request in a `Server-Timing` header of a document response of the Node.js
* server, so the browser SDK continues it in the pageload span before any HTML arrived. Next.js
* flushes the headers with the first chunk of the document, inside the request span, so the value is
* computed then rather than when the request comes in. The hook fires for every request, also when
* incoming request spans are disabled, which the Next.js SDK does because Next.js starts the request
* span.
*/
export declare function addServerTimingTraceHeader(client: Client): void;
/**
* Adds the trace of the current context to the `Server-Timing` header of a document response that no
* shared cache may store. Next.js sends static and ISR documents with `s-maxage`, and a CDN in front of
* the server that stores them would replay the trace, and the sampling decision, of one visitor to
* everyone who gets the cached copy. An existing `sentry-trace` entry of the app is left alone.
*
* @internal
*/
export declare function setServerTimingTraceHeader(response: HttpServerResponse, headers?: HeaderObject): void;
export {};
//# sourceMappingURL=serverTimingHeader.d.ts.map