Back to feed
Dev.to
Dev.to
6/17/2026
Fixing AI Observability: How I Added GenAI Semantic Support for RAG Embedding Spans in Mastra

Fixing AI Observability: How I Added GenAI Semantic Support for RAG Embedding Spans in Mastra

Short summary

The author contributed standardized OpenTelemetry GenAI semantic conventions to Mastra for RAG embedding spans, enabling production observability tools to automatically capture embedding model info, provider details, token usage, and costs without custom integration. Without standardized telemetry, production teams debugging RAG systems lose visibility into embedding bottlenecks and cost drivers. This technical contribution illustrates how infrastructure improvements that enable better monitoring and observability often deliver larger operational impact than visible feature additions.

  • Mastra's RAG embedding spans lacked standardized OpenTelemetry semantic conventions, preventing observability tools from understanding critical metadata
  • Added GenAI semantic mappings (gen_ai.system, gen_ai.request.model, gen_ai.usage.* attributes) to enable automatic telemetry comprehension
  • Small infrastructure contributions that improve observability often deliver outsized operational value in production AI systems

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more