@tigorhutasuhut/telemetry-js - v0.7.3
    Preparing search index...

    Interface TraceHandlerOptions<T>

    Options for traceHandler.

    interface TraceHandlerOptions<T = Response> {
        context: MinimalExecutionContext | undefined;
        env?: Record<string, unknown>;
        exporterEndpoint?: string;
        exporterHeaders?: Record<string, string>;
        handler: () => T | Promise<T>;
        instrumentations?: unknown[];
        logger?: boolean | Logger;
        logsExporterEndpoint?: string;
        maxBodyLogSize?: number;
        metricsExporterEndpoint?: string;
        metricsExportIntervalMs?: number;
        onFlush?: () => void | Promise<void>;
        request: Request;
        resourceAttributes?: Record<string, string>;
        sensitiveHeaders?: string[];
        serviceName?: string;
        tracesExporterEndpoint?: string;
    }

    Type Parameters

    • T = Response

    Hierarchy (View Summary)

    Index

    Properties

    context: MinimalExecutionContext | undefined

    Execution context — only waitUntil is required. Pass undefined during SSG/prerender.

    env?: Record<string, unknown>

    Environment variable map forwarded to the SDK.

    Accepts Record<string, unknown> for compatibility with Cloudflare's Env bindings — only string values are read.

    When used via instrument, this is merged with the fetch env bindings, but fetch env takes precedence on key conflicts.

    exporterEndpoint?: string

    Base OTLP HTTP endpoint (e.g. "https://otel.example.com").

    The SDK appends per-signal paths (/v1/traces, /v1/metrics, /v1/logs) automatically. Use signal-specific endpoints to override individual signals.

    exporterHeaders?: Record<string, string>

    Additional headers sent with every OTLP export request (e.g. auth tokens).

    handler: () => T | Promise<T>

    The handler to call inside the traced span.

    instrumentations?: unknown[]

    OpenTelemetry instrumentations to register (Node only).

    logger?: boolean | Logger

    Logger for automatic request/response logging. When true or omitted, uses getLogger(). When a Logger instance, uses that. When false, no automatic logging is performed.

    true
    
    logsExporterEndpoint?: string

    Signal-specific OTLP endpoint for logs (full URL, no suffix appended).

    maxBodyLogSize?: number

    Maximum bytes to read from request/response bodies for logging.

    65536 (64 KB)
    
    metricsExporterEndpoint?: string

    OTLP HTTP endpoint for the metrics exporter. Falls back to exporterEndpoint + /v1/metrics when omitted.

    metricsExportIntervalMs?: number

    Metrics collection interval in milliseconds (default 60000).

    onFlush?: () => void | Promise<void>

    Optional callback invoked via ctx.waitUntil after the span ends.

    request: Request

    The incoming Request to trace.

    resourceAttributes?: Record<string, string>

    Extra key/value pairs merged into the OpenTelemetry Resource.

    sensitiveHeaders?: string[]

    Header names whose values are replaced with "[REDACTED]" in logs. Overrides the default set (authorization, cookie, set-cookie, x-api-key, proxy-authorization).

    serviceName?: string

    The logical name of the service reported in every span.

    tracesExporterEndpoint?: string

    Signal-specific OTLP endpoint for traces (full URL, no suffix appended).