import { TraceExporter } from "../exporters/types.js"; import { RedactionCounters, RedactionValidatorInstance, RedactionValidatorOptions } from "../redaction/types.js"; import { SamplingOptions } from "./sampling.js"; import { GraphorinSpan } from "./span.js"; import { AISpan, Sensitivity, SpanType, Tracer } from "@graphorin/core"; //#region src/tracer/tracer.d.ts /** * Configuration shape consumed by {@link createTracer}. * * @stable */ interface TracerOptions { /** Logical service name. Embedded in the OTLP `Resource`. */ readonly serviceName?: string; /** * Configured exporters. Each exporter MUST be wrapped via * `withValidation(...)` before reaching the tracer - pass them * through unwrapped to use the tracer-managed validator (set by * `validation`) or pass already-wrapped exporters when you want * per-exporter policies. */ readonly exporters: ReadonlyArray; /** * Tracer-managed validator policy. * * - `RedactionValidatorOptions` (default): the tracer auto-wraps any * un-wrapped exporter with `withValidation(...)` using these * options. * - `'off'`: NOT recommended. Skips auto-wrap, and the tracer logs a * startup WARN to the supplied {@link warnSink}. Pre-wrapped * exporters still flow through their validators. * * @default `{ minTier: 'public', failOnUnredactedSensitive: false }` */ readonly validation?: RedactionValidatorOptions | 'off'; /** Sampler configuration. */ readonly sampling?: SamplingOptions; /** * Default sensitivity for attributes that omit `setAttribute(_, _, { sensitivity })`. * Defaults to `'internal'` per the default-deny non-public posture. */ readonly defaultAttributeSensitivity?: Sensitivity; /** * Sink used for startup WARNings. Defaults to `console.warn`. * * @internal */ readonly warnSink?: (line: string) => void; /** * Override the wall clock used for span timestamps. Returns * milliseconds-since-epoch as a `number`. Default: `Date.now`. * * @internal */ readonly now?: () => number; } /** * The {@link createTracer} return value extends the standard * {@link Tracer} contract from `@graphorin/core` with introspection * helpers (counter snapshots, validator handle). * * @stable */ interface GraphorinTracer extends Tracer { /** Service name embedded in the OTLP resource. */ readonly serviceName: string; /** * Snapshot of the redaction counters (`droppedTotal`, * `droppedByReason`, `matchesByPattern`) maintained by the * tracer-managed validator. */ getMetrics(): RedactionCounters; /** The tracer-managed validator. `null` when `validation: 'off'`. */ readonly validator: RedactionValidatorInstance | null; /** Force-flush every registered exporter. */ flush(): Promise; } declare function createTracer(opts: TracerOptions): GraphorinTracer; /** * Returns the underlying {@link GraphorinSpan} when `span` is a Graphorin * span. Useful when callers want to reach the per-attribute sensitivity * helper from a generic `AISpan`. * * @stable */ declare function asGraphorinSpan(span: AISpan): GraphorinSpan | null; //#endregion export { GraphorinTracer, TracerOptions, asGraphorinSpan, createTracer }; //# sourceMappingURL=tracer.d.ts.map