/** * Base class for observability adapters whose vendor delivery is NOT implemented. * * These adapters accept traces and spans and record them in memory so that * enabling one never breaks a running application. They do NOT send anything * to the vendor: no network call, no API key is read, no endpoint is contacted. * * Because they cannot deliver, they MUST report `isEnabled === false`. An * adapter that reports itself enabled while discarding every span is worse * than one that is absent, because the user believes their traces are safe. * * If you implement real delivery for one of these vendors, stop extending this * class: give the adapter its own `isEnabled` derived from whether the * transport is actually live (see `LangfuseObservabilityAdapter`). */ import type { ObservabilityAdapter, TraceContext, SpanContext, SpanKind, SpanStatus, AttributionContext, ObservabilityToolConfig } from '../../types'; import { MemoryObservabilityAdapter } from '../memory'; /** Emitted on construction and on flush() so the deception is visible at runtime. */ export declare const UNDELIVERED_WARNING_PREFIX = "[OBSERVABILITY]"; export declare abstract class UndeliveredObservabilityAdapter implements ObservabilityAdapter { readonly name: string; /** * Typed as `boolean` rather than the literal `false` on purpose: a subclass * that wrongly sets this to `true` must still compile, so that the test * suite is what catches it rather than a type error that is easy to * silence with a cast. */ readonly isEnabled: boolean; /** Explicit, machine-readable statement that traces never reach the vendor. */ readonly delivers: boolean; protected memory: MemoryObservabilityAdapter; protected config: ObservabilityToolConfig; private warned; constructor(vendor: string, config?: ObservabilityToolConfig); /** Warns once per instance that this adapter cannot deliver traces. */ protected warnNotDelivered(): void; initialize(): Promise; shutdown(): Promise; startTrace(name: string, metadata?: Record, attribution?: AttributionContext): TraceContext; endTrace(traceId: string, status?: SpanStatus): void; startSpan(traceId: string, name: string, kind: SpanKind, parentId?: string): SpanContext; endSpan(spanId: string, status?: SpanStatus, attributes?: Record): void; addEvent(spanId: string, name: string, attributes?: Record): void; recordError(spanId: string, error: Error): void; /** * MUST NOT resolve silently. flush() is the call a user makes to guarantee * delivery before exit; resolving quietly would promise exactly the thing * this adapter cannot do. */ flush(): Promise; }