{"slug": "claude-agent-sdk-monitoring-observability-with-opentelemetry", "title": "Claude Agent SDK Monitoring & Observability with OpenTelemetry", "summary": "SigNoz has released a guide for monitoring Claude Agent SDK applications using OpenTelemetry, enabling developers to export logs, traces, and metrics for real-time visibility into latency, error rates, and usage trends. The integration requires a SigNoz account, Python 3.10+, and an Anthropic API key, with setup involving environment variable configuration and code instrumentation to automatically emit telemetry data to SigNoz dashboards.", "body_md": "Overview\n\nThis guide walks you through setting up monitoring and observability for Claude Agent SDK using [OpenTelemetry](https://opentelemetry.io/) and exporting logs, traces, and metrics to SigNoz. With this integration, you can observe the performance of various models, capture request/response details, and track system-level metrics in SigNoz, giving you real-time visibility into latency, error rates, and usage trends for your Claude Code SDK applications.\n\nInstrumenting Claude Agent SDK in your AI applications with telemetry ensures full observability across your agent workflows, making it easier to debug issues, optimize performance, and understand user interactions. By leveraging SigNoz, you can analyze correlated traces, logs, and metrics in unified dashboards, configure alerts, and gain actionable insights to continuously improve reliability, responsiveness, and user experience.\n\nPrerequisites\n\n- A\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key or[Self Hosted SigNoz instance](https://signoz.io/docs/install/self-host/) - Python 3.10+ with\n`claude-agent-sdk`\n\ninstalled - For Python:\n`pip`\n\ninstalled for managing Python packages - An\n[Anthropic](https://docs.anthropic.com/en/home)API account with a working API Key\n\nMonitoring Claude Agent SDK\n\nFor more information on monitoring Claude Agent SDK with OpenTelemetry, refer to the [official Claude Agent SDK observability documentation](https://code.claude.com/docs/en/agent-sdk/observability).\n\nStep 1: Install the necessary packages in your Python environment.\n\n```\npip install claude-agent-sdk\n```\n\nStep 2: Configure OpenTelemetry environment variables\n\n```\nexport CLAUDE_CODE_ENABLE_TELEMETRY=1\nexport CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1\nexport OTEL_SERVICE_NAME=<service_name>\nexport OTEL_TRACES_EXPORTER=otlp\nexport OTEL_METRICS_EXPORTER=otlp\nexport OTEL_LOGS_EXPORTER=otlp\nexport OTEL_EXPORTER_OTLP_PROTOCOL=\"http/protobuf\"\nexport OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<region>.signoz.cloud:443\nexport OTEL_EXPORTER_OTLP_HEADERS=signoz-ingestion-key=<your-ingestion-key>\n```\n\n: The name of your service`<service_name>`\n\n`<region>`\n\n: Your[SigNoz Cloud region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint)`<your-ingestion-key>`\n\n: Your SigNoz[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nStep 3: Create an example Claude Agent SDK workflow\n\n``` python\nimport asyncio\nfrom claude_agent_sdk import query\n\nasync def main():\n    async for message in query(\n        prompt=\"List the files in this directory\"\n    ):\n        print(message)\n\nasyncio.run(main())\n```\n\n📌 Note: Before running this code, ensure that you have set the environment variable\n\n`ANTHROPIC_API_KEY`\n\nwith your generated API key.\n\nStep 4: Run your application\n\nIn this case:\n\n```\npython main.py\n```\n\nView Traces, Logs, and Metrics in SigNoz\n\nYour Claude Agent SDK usage should now automatically emit traces, logs, and metrics.\n\nYou should be able to view traces 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\nYou should be able to view logs in Signoz Cloud under the logs tab. You can also view logs by clicking on the “Related Logs” button in the trace view to see correlated logs:\n\nWhen you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:\n\nYou should be able to see Claude Agent SDK related metrics in Signoz Cloud under the metrics tab:\n\nWhen you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:\n\nTroubleshooting\n\n[Troubleshooting](#troubleshooting)\n\nIf you don't see your telemetry data:\n\n**Verify network connectivity**- Ensure your application can reach SigNoz Cloud endpoints** Check ingestion key**- Verify your SigNoz ingestion key is correct** Wait for data**- OpenTelemetry batches data before sending, so wait 10-30 seconds after making API calls** Try a console exporter**— Enable a console exporter locally to confirm that your application is generating telemetry data before it’s sent to SigNoz\n\nNext Steps\n\nYou can also check out our custom Claude Agent SDK dashboard [here](https://signoz.io/docs/dashboards/dashboard-templates/claude-agent-sdk-dashboard/) which provides specialized visualizations for monitoring your Claude Agent SDK usage in applications. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.\n\nAdditional resources:\n\n- Set up\n[alerts](https://signoz.io/docs/alerts/)for high latency or error rates - Learn more about\n[querying traces](https://signoz.io/docs/userguide/traces/) - Explore\n[log correlation](https://signoz.io/docs/userguide/logs_query_builder/)", "url": "https://wpnews.pro/news/claude-agent-sdk-monitoring-observability-with-opentelemetry", "canonical_source": "https://signoz.io/docs/claude-agent-monitoring", "published_at": "2026-06-09 00:00:00+00:00", "updated_at": "2026-06-11 17:59:46.206651+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-tools", "ai-infrastructure", "mlops"], "entities": ["Claude Agent SDK", "OpenTelemetry", "SigNoz", "Anthropic", "Claude Code SDK"], "alternates": {"html": "https://wpnews.pro/news/claude-agent-sdk-monitoring-observability-with-opentelemetry", "markdown": "https://wpnews.pro/news/claude-agent-sdk-monitoring-observability-with-opentelemetry.md", "text": "https://wpnews.pro/news/claude-agent-sdk-monitoring-observability-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/claude-agent-sdk-monitoring-observability-with-opentelemetry.jsonld"}}