Skip to content

traceIo

Copy each Mastra chat turn’s request/response onto the active OTel root span so Databricks-managed MLflow can display them.

Why this exists: MLflow’s UC <target>_trace_unified view picks the one span whose parent_span_id is empty and reads request/response from mlflow.spanInputs / mlflow.spanOutputs (or the gen_ai.* equivalents) on THAT span only. Mastra records the turn on its invoke_agent child under mastra.agent_run.input / .output, keys the view never reads, so chat traces arrive with both columns null even when the spans themselves look healthy.

The active span inside the Mastra sub-app is still AppKit’s HTTP server span (OTel context is async-local). With OTEL_PROPAGATORS=none that span is the trace root - see the package README’s observability section for why Apps ingress traceparent otherwise hides every turn.