maple-agent-tracing-mastra
Maple agent tracing: Mastra
Goal: every conversation = one Maple Agent Session. Each agent.generate() / agent.stream() / workflow run.start() = one turn (one trace) with transcript, chat <model> spans with tokens, execute_tool <tool> spans with args/results, failed tools marked failed, sub-agents in their own lanes.
The session key is gen_ai.conversation.id; the exporter writes it from span metadata.threadId, which Mastra sets from memory.thread. No thread = no session key.
Mastra 1.71 has three export gaps that a small span processor (Step 2) fixes; it is required in every setup: the chat span has no input messages (empty prompt side of the transcript), sub-agents get their own thread id (turn split, wrong session), and step spans carry the raw provider HTTP response (headers with cookies, full reply body) as mastra.metadata.headers / mastra.metadata.body, which hideOutput does not hide.