Mastra 推出 Span 查询以细粒度观测智能体追踪
Mastra 宣布推出 span 查询,可跨所有追踪筛选和分组单个 span,而不像 trace 查询那样返回整条追踪。据 Mastra Blog 称,单次查询最多可组合 100 个条件(如 spanType、entityName、status、durationMs、parentEntityName),每页最多返回 1,000 个 span,并可按最多两个维度在最长 365 天的时间范围内分组,聚合出计数、错误率与延迟指标。该功能可通过 Mastra CLI(需 [email protected] 及以上)、Mastra 平台与 Studio、Mastra Client SDK(需 @mastra/[email protected] 及以上)以及可观测性端点使用,也支持使用 DuckDB、PostgreSQL 或 ClickHouse 存储的自托管项目。
Span 查询让 AI 智能体开发者能直接定位失败或缓慢的工具调用并跟踪延迟趋势,厂商称编码智能体也能运行同样的查询并据此修复问题。
You can now use span queries to filter and group individual spans across all of your traces. Mastra platform and Studio support span filtering and grouping by time range, type, name, status, error, duration, and more. Your coding agent can run the same queries, then fix what it finds.
Trace queries can filter on details deep within a trace, like a failed tool call, but will return the whole trace, making problematic calls harder to spot. Span queries are more granular and search within each trace to return just the matching spans.
Your browser does not support the video tag.
Span queries can be used to group or aggregate across matching spans to produce measures like counts, error rates, and latency. Use them to spot which tool is failing or slow, or to track tool latency over time, then use span queries with the same filters to inspect the problematic calls. Each query can combine up to 100 conditions, using fields like spanType, entityName, status, durationMs, and parentEntityName. Span queries return up to 1,000 spans per page, and span groups can group by up to 2 dimensions over a timeRange of up to 365 days.
#Mastra#Mastra CLI#Mastra Client SDK#Mastra Studio#DuckDB#PostgreSQL#ClickHouse