Skip to main content

ArizeExporter

Sends Tracing data to Arize Phoenix, Arize AX, or any OpenTelemetry-compatible observability platform that supports OpenInference semantic conventions.

Constructor
Direct link to Constructor

new ArizeExporter(config: ArizeExporterConfig)

ArizeExporterConfig
Direct link to ArizeExporterConfig

type ArizeExporterConfig = Omit<OtelExporterConfig, 'provider'> & {
// Phoenix / OpenTelemetry configuration
endpoint?: string;
apiKey?: string;

// Arize AX configuration
spaceId?: string;

// Common configuration
projectName?: string;
headers?: Record<string, string>;
}

Inherits from OtelExporterConfig (excluding provider), which includes:

  • timeout?: number - Export timeout in milliseconds (default: 30000)
  • batchSize?: number - Number of spans per batch (default: 512)
  • logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error' - Log level (default: WARN)
  • resourceAttributes?: Record<string, any> - Custom resource attributes

Metadata passthrough
Direct link to Metadata passthrough

Non-reserved span attributes are serialized into the OpenInference metadata payload. Add them via tracingOptions.metadata (e.g., companyId, tier). Reserved fields such as input, output, sessionId, thread/user IDs, and OpenInference IDs are excluded automatically.

Methods
Direct link to Methods

exportTracingEvent
Direct link to exportTracingEvent

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

Exports a tracing event to the configured endpoint.

export
Direct link to export

async export(spans: ReadOnlySpan[]): Promise<void>

Batch exports spans using OpenTelemetry with OpenInference semantic conventions.

shutdown
Direct link to shutdown

async shutdown(): Promise<void>

Flushes pending data and shuts down the client.

Usage
Direct link to Usage

Phoenix Configuration
Direct link to Phoenix Configuration

import { ArizeExporter } from "@mastra/arize";

const exporter = new ArizeExporter({
endpoint: "http://localhost:6006/v1/traces",
apiKey: process.env.PHOENIX_API_KEY, // Optional for local Phoenix
projectName: "my-ai-project",
});

Arize AX Configuration
Direct link to Arize AX Configuration

import { ArizeExporter } from "@mastra/arize";

const exporter = new ArizeExporter({
spaceId: process.env.ARIZE_SPACE_ID!,
apiKey: process.env.ARIZE_API_KEY!,
projectName: "my-ai-project",
});

OpenInference Semantic Conventions
Direct link to OpenInference Semantic Conventions

The ArizeExporter implements OpenInference Semantic Conventions for generative AI applications, providing standardized trace structure across different observability platforms.

Tags Support
Direct link to Tags Support

The ArizeExporter supports trace tagging for categorization and filtering. Tags are only applied to root spans and are mapped to the native OpenInference tag.tags semantic convention.

Usage
Direct link to Usage

const result = await agent.generate({
messages: [{ role: "user", content: "Hello" }],
tracingOptions: {
tags: ["production", "experiment-v2", "user-request"],
},
});

How Tags Are Stored
Direct link to How Tags Are Stored

Tags are stored using the OpenInference tag.tags attribute:

{
"tag.tags": ["production", "experiment-v2", "user-request"]
}