Skip to main content
Mastra 1.0 is available 🎉 Read announcement

LaminarExporter

Sends Tracing data to Laminar via OTLP/HTTP (protobuf).

Constructor
Direct link to Constructor

new LaminarExporter(config?: LaminarExporterConfig)

LaminarExporterConfig
Direct link to LaminarExporterConfig

interface LaminarExporterConfig extends BaseExporterConfig {
apiKey?: string;
baseUrl?: string;
endpoint?: string;
headers?: Record<string, string>;
realtime?: boolean;
disableBatch?: boolean;
batchSize?: number;
timeoutMillis?: number;
}

Extends BaseExporterConfig, which includes:

  • logger?: IMastraLogger - Logger instance
  • logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error' - Log level (default: INFO)

Methods
Direct link to Methods

exportTracingEvent
Direct link to exportTracingEvent

async exportTracingEvent(event: TracingEvent): Promise<void>

Exports a tracing event to Laminar.

flush
Direct link to flush

async flush(): Promise<void>

Force flushes any buffered spans to Laminar without shutting down the exporter. Useful in serverless environments where you need to ensure spans are exported before the runtime terminates.

shutdown
Direct link to shutdown

async shutdown(): Promise<void>

Flushes pending data and shuts down the exporter.

Usage
Direct link to Usage

Zero-Config (using environment variables)
Direct link to Zero-Config (using environment variables)

import { LaminarExporter } from "@mastra/laminar";

// Reads from LMNR_PROJECT_API_KEY, LMNR_BASE_URL, LAMINAR_ENDPOINT
const exporter = new LaminarExporter();

Explicit Configuration
Direct link to Explicit Configuration

import { LaminarExporter } from "@mastra/laminar";

const exporter = new LaminarExporter({
apiKey: process.env.LMNR_PROJECT_API_KEY,
baseUrl: "https://api.lmnr.ai",
realtime: true,
});