SigNoz
Docs
PricingCustomers
Get Started - Free
Docs
IntroductionContributingMigrate from DatadogSigNoz API
OpenTelemetry
What is OpenTelemetryOpenTelemetry Collector GuideOpenTelemetry Demo
Community
Support
Slack
X
Launch Week
Changelog
Dashboard Templates
DevOps Wordle
Newsletter
KubeCon, Atlanta 2025
More
SigNoz vs DatadogSigNoz vs New RelicSigNoz vs GrafanaSigNoz vs Dynatrace
Careers
AboutTermsPrivacySecurity & Compliance
SigNoz Logo
SigNoz
All systems operational
HIPAASOC-2
SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

Claude Agent SDK Monitoring & Observability with OpenTelemetry

Overview

This guide walks you through setting up monitoring and observability for Claude Agent SDK using OpenTelemetry 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.

Instrumenting 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.

Prerequisites

  • A SigNoz Cloud account with an active ingestion key or Self Hosted SigNoz instance
  • Python 3.10+ with claude-agent-sdk installed
  • For Python: pip installed for managing Python packages
  • An Anthropic API account with a working API Key

Monitoring Claude Agent SDK

For more information on monitoring Claude Agent SDK with OpenTelemetry, refer to the official Claude Agent SDK observability documentation.

Step 1: Install the necessary packages in your Python environment.

pip install claude-agent-sdk

Step 2: Configure OpenTelemetry environment variables

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1
export OTEL_SERVICE_NAME=<service_name>
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<region>.signoz.cloud:443
export OTEL_EXPORTER_OTLP_HEADERS=signoz-ingestion-key=<your-ingestion-key>
  • <service_name>: The name of your service
  • <region>: Your SigNoz Cloud region
  • <your-ingestion-key>: Your SigNoz ingestion key

Using 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.

Step 3: Create an example Claude Agent SDK workflow

main.py
import asyncio
from claude_agent_sdk import query

async def main():
    async for message in query(
        prompt="List the files in this directory"
    ):
        print(message)

asyncio.run(main())

📌 Note: Before running this code, ensure that you have set the environment variable ANTHROPIC_API_KEY with your generated API key.

Step 4: Run your application

In this case:

python main.py

View Traces, Logs, and Metrics in SigNoz

Your Claude Agent SDK usage should now automatically emit traces, logs, and metrics.

You should be able to view traces in Signoz Cloud under the traces tab:

Claude Agent SDK Trace View
Claude Agent SDK Trace View

When 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.

Claude Agent SDK Detailed Trace View
Claude Agent SDK Detailed Trace View

You 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:

Related logs
Related logs button
Claude Agent SDK Logs View
Claude Agent SDK Logs View

When you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:

Claude Agent SDK Detailed Log View
Claude Agent SDK Detailed Logs View

You should be able to see Claude Agent SDK related metrics in Signoz Cloud under the metrics tab:

Claude Agent SDK Metrics View
Claude Agent SDK Metrics View

When you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:

Claude Agent SDK Detailed Metrics View
Claude Agent SDK Detailed Metrics View

Troubleshooting

If you don't see your telemetry data:

  1. Verify network connectivity - Ensure your application can reach SigNoz Cloud endpoints
  2. Check ingestion key - Verify your SigNoz ingestion key is correct
  3. Wait for data - OpenTelemetry batches data before sending, so wait 10-30 seconds after making API calls
  4. Try a console exporter — Enable a console exporter locally to confirm that your application is generating telemetry data before it’s sent to SigNoz

Next Steps

You can also check out our custom Claude Agent SDK dashboard here 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.

Claude Agent SDK Dashboard
Claude Agent SDK Dashboard Template

Additional resources:

  • Set up alerts for high latency or error rates
  • Learn more about querying traces
  • Explore log correlation

Last updated: May 18, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.

Prev
Claude Code
Next
Codex (OpenAI)
On this page
Overview
Prerequisites
Monitoring Claude Agent SDK
Step 1: Install the necessary packages in your Python environment.
Step 2: Configure OpenTelemetry environment variables
Step 3: Create an example Claude Agent SDK workflow
Step 4: Run your application
View Traces, Logs, and Metrics in SigNoz
Troubleshooting
Next Steps

Is this page helpful?

Your response helps us improve this page.