跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

LaminarExporter

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

Constructor
Constructor的直接链接

new LaminarExporter(config?: LaminarExporterConfig)

LaminarExporterConfig
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
Methods的直接链接

exportTracingEvent
exporttracingevent的直接链接

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

Exports a tracing event to Laminar.

flush
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
shutdown的直接链接

async shutdown(): Promise<void>

Flushes pending data and shuts down the exporter.

Usage
Usage的直接链接

Zero-Config (using environment variables)
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
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,
})