←新闻详情

Mastra Blog更新于 10月15日 00:52

Mastra 平台推出 Trace Imports,首批支持从 Langfuse 导入历史追踪

Introducing Trace Imports for Mastra Platform | Mastra Blog

AI 导读

Mastra 平台上线 Trace Imports,可将第三方可观测性平台的历史 trace 导入并与 Mastra 生成的 trace 并列展示,首批支持 Langfuse。导入保留 agent_run、model_generation、tool_call 等 span 类型及父子结构、时间戳、输入输出、用量和成本,但 scores、feedback、datasets、attachments 和 logs 不导入。该功能需 mastra@1.34.1 和 @mastra/core@1.77.0 及以上版本,支持 --dry-run 预览、--since/--until 日期范围和 --resume 续传。

正文

当前显示原文,中文全文译文尚未就绪。

Import and inspect existing trace history.

Oct 14, 2026

3 min read

You can now import existing traces from third-party observability providers using trace imports.

Imported traces show up alongside your Mastra-generated traces in Mastra platform (and deployed Studio), letting you debug, filter and compare across your trace history without switching between tools.

We're starting today with Langfuse support, with more providers to follow.

Switching observability providers often means losing valuable trace history, with existing data left behind on the previous provider. By using trace imports, you can switch to Mastra and bring your trace history with you.

Before trace imports, Mastra observability data could only be exported to third-party providers. Now you can pull it back with the details preserved: span types like agent_run, model_generation and tool_call stay intact, along with parent-child structure, timestamps, inputs, outputs, usage and cost. Only trace observations are imported; scores, feedback, datasets, attachments and logs are omitted.

Upgrade the Mastra CLI and @mastra/core dependencies:

Requires mastra@1.34.1 and @mastra/core@1.77.0 or later, added in PR #24145 and PR #26779.

Trace imports target a Mastra project deployed to Mastra platform. The project's access token and ID should already be set in .env:

To import traces from a Langfuse project, create an API key under Settings → API Keys in Langfuse, then add the following environment variables to your .env:

LANGFUSE_BASE_URL defaults to the EU region. Set it to your Langfuse region, or self-hosted URL.

Preview an import

Set --target-project to the name of your deployed Mastra project, and use --dry-run to preview an import:

Output:

Import

Omit --dry-run to import the traces. The CLI shows the same summary, asks for confirmation, uploads, then verifies. You can use --yes to skip the confirmation:

Date window

To import traces from a specific date range, use the --since and --until flags with ISO 8601 timestamps:

Resume

To continue an import that was interrupted, or to upload one you previewed with --dry-run, use the --resume flag with the import ID:

For more information and full configuration options, see:

Import existing traces; mastra traces import reference; Observability on Mastra platform; LangfuseExporter reference; Langfuse integration; Langfuse API keys; Langfuse data regions

Paul Scanlon sits between Developer Education and Product Marketing at Mastra. Previously, he was a Technical Product Marketing Manager at Neon and worked in Developer Relations at Gatsby, where he created educational content and developer experiences.

On this page

来源

Mastra Blog