Package Exports
- @mastra/observability
- @mastra/observability/package.json
Readme
Mastra Observability
Tracing and monitoring for AI operations in Mastra.
Installation
npm install @mastra/observabilityQuick Start
import { Mastra } from '@mastra/core';
import { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';
export const mastra = new Mastra({
observability: new Observability({
configs: {
default: {
serviceName: 'my-app',
exporters: [
new DefaultExporter(), // Persists traces for Mastra Studio
new CloudExporter(), // Sends to Mastra Cloud
],
spanOutputProcessors: [new SensitiveDataFilter()],
},
},
}),
});Features
- Auto-instrumentation - Traces agent runs, LLM calls, tool executions, and workflows
- Pluggable Exporters - Exporters for Studio and Cloud, plus integrations for Arize, Braintrust, Langfuse, LangSmith, and OpenTelemetry
- Sampling Strategies - Always, ratio-based, or custom sampling
- Span Processors - Transform or filter span data before export
- OpenTelemetry Compatible - Standard trace/span ID formats for integration
Span Types
WORKFLOW_RUN- Workflow executionWORKFLOW_STEP- Individual workflow stepAGENT_RUN- Agent processingMODEL_GENERATION- LLM API callsTOOL_CALL- Tool executionMCP_TOOL_CALL- MCP tool executionPROCESSOR_RUN- Processor executionGENERIC- Custom operations
Documentation
For configuration options, exporters, sampling strategies, and more, see the full documentation.