OtelExporter that targets any OTLP endpoint. Wire it into your Mastra instance, then pass userId / conversationId per call.
Mastra traces can include prompts, completions, tool inputs, and tool outputs. Review Data Governance before enabling production traffic.
1. Install
Already have@mastra/observability and @mastra/otel-exporter? Skip.
No Observability set up yet?
2. Wire the OtelExporter pointing at Agnost
Already have Mastra Observability? Append Agnost to the existingexporters array: Mastra fans traces out to every exporter in the list:
3. Pass userId / conversationId per call
userId, conversationId, and threadId in tracingOptions.metadata are read by Agnost for user / session grouping.
What appears in Agnost
- Conversations grouped by
conversationIdorthreadId. - User-level analytics grouped by
userId. - Raw logs for spans exported by Mastra.
Verify
Run oneagent.generate call, then open Raw logs in Agnost. Confirm the span has your userId and conversationId.
Troubleshooting
- Confirm the
OtelExporteris included in the active Mastra observability config. - Confirm
protocol: 'http/protobuf'and/v1/tracesare used. - Confirm metadata keys are spelled
userId,conversationId, orthreadId.
