{"slug": "mastra-observability-monitoring-with-opentelemetry", "title": "Mastra Observability & Monitoring with OpenTelemetry", "summary": "SigNoz announced support for Mastra observability through OpenTelemetry, enabling developers to instrument AI applications and export traces for real-time monitoring of model performance, latency, error rates, and usage trends. The integration allows users to correlate traces, logs, and metrics across AI workflows, set alerts, and improve application reliability. Developers can set up the monitoring by configuring an OpenTelemetry exporter with a SigNoz ingestion key and registering agents with telemetry enabled in their Mastra projects.", "body_md": "What is Mastra Observability?\n\nMastra observability lets you instrument your AI applications using [OpenTelemetry](https://opentelemetry.io/) and export traces to SigNoz. This guide walks you through setting up Mastra monitoring so you get real-time visibility into model performance, latency, error rates, and usage trends across your Mastra applications.\n\nWith full Mastra observability in SigNoz, you can correlate traces, logs, and metrics across AI workflows, set alerts on error rates and latency, and continuously improve the reliability of your Mastra applications.\n\nPrerequisites\n\n- A\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key - Internet access to send telemetry data to SigNoz Cloud\n- Node.js (v20.0 or higher)\n- An API key from a supported\n[Model Provider](https://mastra.ai/en/models/providers)\n\nSetting Up Mastra Observability with OpenTelemetry\n\nYou can get the full [Mastra installation instructions](https://mastra.ai/en/docs/getting-started/installation).\n\n**Step 1:** Start the CLI Wizard\n\nRun the following command to start the interactive setup:\n\n```\nnpx create-mastra@latest\nyarn dlx create-mastra@latest\npnpm create mastra@latest\nbun create mastra@latest\n```\n\n**Step 2:** Add Your API key\n\nAdd your API key to the `.env`\n\nfile:\n\n```\nOPENAI_API_KEY=<your-api-key>\n```\n\nThis example uses OpenAI. Each LLM provider uses a unique name. See\n\n[Model Capabilities]for more information.\n\nSetup an Agent\n\n**Step 1:** Create an agent in your project.\n\nFor example, create a file `src/mastra/agents/chefAgent.ts`\n\n:\n\n``` js\nimport { openai } from \"@ai-sdk/openai\";\nimport { Agent } from \"@mastra/core/agent\";\n\nexport const chefAgent = new Agent({\n  name: \"chef-agent\",\n  instructions:\n    \"You are Michel, a practical and experienced home chef\" +\n    \"You help people cook with whatever ingredients they have available.\",\n  model: openai(\"gpt-4o-mini\"),\n});\n```\n\n**Step 2:** Register the Agent with Mastra\n\nIn your `src/mastra/index.ts`\n\nfile, register the agent with telemetry enabled:\n\n``` js\nimport { Mastra } from \"@mastra/core\";\nimport { chefAgent } from \"./agents/chefAgent\";\nimport { OtelExporter } from \"@mastra/otel-exporter\";\n\nexport const mastra = new Mastra({\n  agents: { chefAgent },\n  observability: {\n    configs: {\n      otel: {\n        serviceName: '<service-name>',\n        exporters: [\n          new OtelExporter({\n            provider: {\n              signoz: {\n                apiKey: process.env.SIGNOZ_INGESTION_KEY,\n                region: 'us', // 'us' | 'eu' | 'in',\n              }\n            },\n          })\n        ],\n      },\n    },\n  },\n});\n```\n\nis the name of your service`<service_name>`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/). Set the value as an environment variable.→ appropriate`region`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint)\n\n**Step 3:** Run Mastra Dev Server and Interact with Agent\n\n```\nnpm run dev\n```\n\nYou should see some output similar to this:\n\nVisit the playground url, and start chatting with the registered agent. All your interactions should be traced and sent to SigNoz under the traces tab.\n\nView Mastra Traces in SigNoz\n\nOnce configured, your Mastra application automatically emits traces.\n\nTraces are available in SigNoz Cloud under the Traces tab:\n\nWhen you click on a trace in SigNoz, you'll see a detailed view of the trace, including all associated spans, along with their events and attributes.\n\nMastra Observability Dashboard\n\nYou can also check out our [Mastra Dashboard](https://signoz.io/docs/dashboards/dashboard-templates/mastra-dashboard/) which provides specialized visualizations for Mastra monitoring in your applications. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.", "url": "https://wpnews.pro/news/mastra-observability-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/mastra-observability", "published_at": "2026-05-27 00:00:00+00:00", "updated_at": "2026-05-29 16:25:57.401490+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-tools", "ai-infrastructure", "mlops", "ai-agents"], "entities": ["Mastra", "OpenTelemetry", "SigNoz", "OpenAI", "SigNoz Cloud"], "alternates": {"html": "https://wpnews.pro/news/mastra-observability-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/mastra-observability-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/mastra-observability-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/mastra-observability-monitoring-with-opentelemetry.jsonld"}}