Beignet API reference
    Preparing search index...

    Interface DevtoolsHooksOptions<Ctx>

    Options for server hooks that record request/error events to devtools.

    interface DevtoolsHooksOptions<Ctx> {
        basePath?: string;
        getRequestId?: (
            args: { ctx?: Ctx; req: HttpRequestLike; response?: HttpResponseLike },
        ) => string | undefined;
        getTraceContext?: (
            args: { ctx?: Ctx; req: HttpRequestLike; response?: HttpResponseLike },
        ) => string | DevtoolsTraceContextInput | undefined;
        redact?: DevtoolsRedactor;
        requestIdHeader?: string | false;
        shouldCapture?: (
            args: {
                contract: HttpContractConfig;
                ctx?: Ctx;
                error?: unknown;
                req: HttpRequestLike;
                response: HttpResponseLike;
            },
        ) => boolean;
        traceContextHeader?: string
        | false;
    }

    Type Parameters

    • Ctx
    Index

    Properties

    basePath?: string

    Devtools route prefix. Requests under this path are ignored to avoid filling the timeline with its own polling traffic.

    "/api/devtools"
    
    getRequestId?: (
        args: { ctx?: Ctx; req: HttpRequestLike; response?: HttpResponseLike },
    ) => string | undefined

    Resolve the request ID used for event correlation.

    getTraceContext?: (
        args: { ctx?: Ctx; req: HttpRequestLike; response?: HttpResponseLike },
    ) => string | DevtoolsTraceContextInput | undefined

    Resolve a trace context from request/context/response data.

    Apply a custom redactor to events produced by these hooks. The default devtools redactor still runs when events are stored.

    requestIdHeader?: string | false

    Response header used to expose the resolved request ID.

    Pass false to avoid writing a header.

    "x-request-id"
    
    shouldCapture?: (
        args: {
            contract: HttpContractConfig;
            ctx?: Ctx;
            error?: unknown;
            req: HttpRequestLike;
            response: HttpResponseLike;
        },
    ) => boolean

    Decide whether to capture a completed request event.

    traceContextHeader?: string | false

    W3C trace context header used to correlate devtools events with distributed traces.

    Pass false to avoid writing a header.

    "traceparent"