/** * A dependency-free OTLP/HTTP (JSON) span exporter. Ships completed spans to any OpenTelemetry * collector (`.../v1/traces`) with in-process batching, matching the package's no-SDK stance: it * speaks the wire protocol directly over `fetch`, so it runs on Bun, Node, Deno, and workerd alike. * * Wire mapping follows the OTLP/JSON encoding: ids stay hex, times become Unix-nanosecond strings, * attributes become typed `KeyValue`s. Export is fail-open (a collector outage never throws into a * request); delivery failures reach `onError`. */ import type { ObservationAdapter } from "./span.js"; export interface OtlpExporterOptions { /** The collector's traces endpoint, e.g. `http://localhost:4318/v1/traces`. */ readonly url: string; /** Extra headers on every export (auth tokens, tenant ids). */ readonly headers?: Record; /** `service.name` resource attribute. Default `"nifra"`. */ readonly serviceName?: string; /** Batching knobs. */ readonly batch?: { /** Flush once this many spans are queued. Must be a positive safe integer. Default 512. */ readonly maxBatch?: number; /** Hard cap on the queue; oldest spans are dropped past it. Positive safe integer; default 2048. */ readonly maxQueue?: number; /** Periodic flush interval (ms). Must be a positive safe integer. Default 5000. */ readonly flushIntervalMs?: number; }; /** Called when an export POST fails or spans are dropped. Fail-open: never throws into a request. */ readonly onError?: (error: unknown) => void; /** Override `fetch` (tests, a proxy agent). Defaults to the global. */ readonly fetch?: (input: string, init: RequestInit) => Promise<{ ok: boolean; status: number; }>; } export interface OtlpExporter extends ObservationAdapter { /** Send everything queued now. Await it in a graceful shutdown so no span is lost. */ flush(): Promise; /** Stop the periodic timer and flush a final time. Call on server stop. */ shutdown(): Promise; } export declare function otlpExporter(options: OtlpExporterOptions): OtlpExporter; //# sourceMappingURL=otlp.d.ts.map