Studio Observability
Trust: ★★★☆☆ (0.90) · 0 validations · developer_reference
Published: 2026-05-10 · Source: crawler_authoritative
Tình huống
Mastra Studio observability documentation covering Metrics, Traces, and Logs views for monitoring agent, workflow, and tool performance. Targets developers configuring and using Mastra’s built-in observability capabilities.
Insight
Studio provides three observability views. Metrics displays aggregate performance data including total agent runs, model cost, token consumption, scorer performance, model-specific usage breakdowns, latency percentiles (p50 and p95), and trace volume with error counts over a configurable time range (24 hours to 30 days). Traces show individual request inspection highlighting AI operations like model calls, tool executions, and workflow steps, filtering out low-level framework details for readability. Logs provide full-text search across message content, entity names, and trace IDs with date presets and multi-select filters for level, entity type, and entity name; log detail panels show structured data and metadata with navigation to correlated traces. All three views require an observability storage backend to be configured. Metrics specifically require a separate OLAP store (DuckDB) and do not support relational databases like PostgreSQL or LibSQL; in-memory storage resets on restart.
Hành động
Install observability packages using npm install @mastra/observability @mastra/libsql @mastra/duckdb (or pnpm/yarn/bun equivalents). Configure in src/mastra/index.ts by importing Mastra, LibSQLStore, DuckDBStore, MastraCompositeStore, and observability components (Observability, DefaultExporter, CloudExporter, SensitiveDataFilter). Create a MastraCompositeStore with LibSQLStore for default storage and DuckDBStore for the observability domain. Initialize Observability with configs containing serviceName, exporters (DefaultExporter for local traces, CloudExporter for hosted Studio), and spanOutputProcessors (SensitiveDataFilter to redact passwords, tokens, and keys).
Kết quả
After configuration, the Observability tab in Studio displays metrics dashboards, traces for individual request inspection, and searchable logs with trace correlation. DefaultExporter persists traces locally; CloudExporter sends data to hosted Mastra Studio when MASTRA_CLOUD_ACCESS_TOKEN is set.
Điều kiện áp dụng
Metrics require a separate OLAP store (DuckDB) - relational databases like PostgreSQL, LibSQL are not supported for metrics. In-memory storage resets on restart and is not suitable for metrics.
Nội dung gốc (Original)
Studio observability
Studio includes these observability views:
- Metrics for aggregate performance data
- Traces for individual request inspection
- Logs for browsing internal and application logs
All require an observability storage backend to be configured.
Metrics
A dashboard that summarizes agent, workflow, and tool performance over a configurable time range (last 24 hours to 30 days). The top row shows total agent runs, model cost, token consumption, and average scorer performance. Below that, detailed cards break down model usage and cost per model, token usage per agent, trace volume with completed and error counts, latency percentiles (p50 and p95), and scorer trends over time.
Visit the metrics overview for more details.
Note: Metrics require a separate OLAP store for observability. Relational databases like PostgreSQL, LibSQL, etc. are not supported for metrics. In-memory storage resets on restart.
Traces
When you run an agent or workflow, the Observability tab displays traces that highlight the key AI operations such as model calls, tool executions, and workflow steps. Follow these traces to see how data moves, where time is spent, and what’s happening under the hood.
Tracing filters out low-level framework details so your traces stay focused and readable. Visit the tracing overview for more details.
Logs
Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can navigate directly to the trace and span timeline.
Log forwarding is enabled by default when you configure observability. See logging for level configuration, query examples, and customization details.
Quickstart
For detailed instructions, follow the observability instructions. To get up and running quickly, add the @mastra/observability package to your project and configure it with LibSQL and DuckDB for a local development setup that supports both traces and metrics.
npm:
npm install @mastra/observability @mastra/libsql @mastra/duckdbpnpm:
pnpm add @mastra/observability @mastra/libsql @mastra/duckdbYarn:
yarn add @mastra/observability @mastra/libsql @mastra/duckdbBun:
bun add @mastra/observability @mastra/libsql @mastra/duckdbThen add the following to your src/mastra/index.ts:
import { Mastra } from '@mastra/core/mastra'
import { LibSQLStore } from '@mastra/libsql'
import { DuckDBStore } from '@mastra/duckdb'
import { MastraCompositeStore } from '@mastra/core/storage'
import {
Observability,
DefaultExporter,
CloudExporter,
SensitiveDataFilter,
} from '@mastra/observability'
export const mastra = new Mastra({
storage: new MastraCompositeStore({
id: 'composite-storage',
default: new LibSQLStore({
id: 'mastra-storage',
url: 'file:./mastra.db',
}),
domains: {
observability: await new DuckDBStore().getStore('observability'),
},
}),
observability: new Observability({
configs: {
default: {
serviceName: 'mastra',
exporters: [
new DefaultExporter(), // Persists traces to storage for Mastra Studio
new CloudExporter(), // Sends observability data to hosted Mastra Studio (if MASTRA_CLOUD_ACCESS_TOKEN is set)
],
spanOutputProcessors: [
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
],
},
},
}),
})Related
Liên kết
- Nền tảng: Dev Framework · Mastra
- Nguồn: https://mastra.ai/docs/studio/observability
Xem thêm: