/** * Laminar Exporter for Mastra Observability * * This exporter sends observability data to Laminar via OTLP/HTTP (protobuf). * It also implements addScoreToTrace() to attach scorer results in Laminar. */ import type { InitExporterOptions, ScoreEvent, TracingEvent } from '@mastra/core/observability'; import { BaseExporter } from '@mastra/observability'; import type { BaseExporterConfig } from '@mastra/observability'; export interface LaminarExporterConfig extends BaseExporterConfig { /** * Laminar project API key. Defaults to `process.env.LMNR_PROJECT_API_KEY`. */ apiKey?: string; /** * Base URL for Laminar APIs. Defaults to `process.env.LMNR_BASE_URL` or `https://api.lmnr.ai`. * * Used for: * - trace exports (if `endpoint`/`LAMINAR_ENDPOINT` are not set) * - evaluator scoring (`/v1/evaluators/score`) */ baseUrl?: string; /** * Full OTLP/HTTP traces endpoint. Defaults to `process.env.LAMINAR_ENDPOINT` or `${baseUrl}/v1/traces`. */ endpoint?: string; /** * Additional headers to include in OTLP requests. */ headers?: Record; /** * Flush after each span for near-realtime visibility. */ realtime?: boolean; /** * Disable batching (uses SimpleSpanProcessor). */ disableBatch?: boolean; /** * Max spans to export per batch (BatchSpanProcessor only). */ batchSize?: number; /** * OTLP export timeout in milliseconds. */ timeoutMillis?: number; } export declare class LaminarExporter extends BaseExporter { name: string; private config; private traceMap; private resource?; private scope?; private processor?; private exporter?; private isSetup; constructor(config?: LaminarExporterConfig); init(options: InitExporterOptions): void; protected _exportTracingEvent(event: TracingEvent): Promise; private handleSpanStarted; private handleSpanEnded; private getOrCreateTraceState; private convertSpanToOtel; private setupIfNeeded; private submitScore; onScoreEvent(event: ScoreEvent): Promise; /** * @deprecated Use the observability score event pipeline (`mastra.observability.addScore`) * instead. Preserved for backwards compatibility; forwards to the same Laminar score endpoint * as `onScoreEvent`. */ _addScoreToTrace(args: { traceId: string; spanId?: string; score: number; reason?: string; scorerName: string; metadata?: Record; }): Promise; /** * Force flush any buffered spans without shutting down the exporter. * This is useful in serverless environments where you need to ensure spans * are exported before the runtime instance is terminated. */ flush(): Promise; shutdown(): Promise; } export declare function stripTrailingSlash(url: string): string; export declare function otelSpanIdToUUID(spanId: string): string; export declare function otelTraceIdToUUID(traceId: string): string; //# sourceMappingURL=tracing.d.ts.map